This script aims at easing the after-install process in which we usually do the same actions every time. As WordPress has its own on-install customization tools, we'll use them.
You might think that each project is unique and needs its own customization -and somehow you'd be right- but you just need a minute to think and get to a simple conclusion: every time you start a new WordPress project, you do the same actions:
- Install&Setup your preferred theme
- Install&Setup your preferred plugins
- Setup the WordPress site's options
But you can avoid doing this actions by yourself just using the same processes used by WordPress itself: the wp_install_defaults() function and WP CLI.
In this project, I'm trying to cover both methods so I -and you, by the way- can take advantage of them to automate and speed the first site setup.
WordPress-On-Install is created with:
- PHP
- Shellscript -WP CLI-
- Get the WordPress files and upload them to your hosting
- DO NOT INSTALL WORDPRESS!!!
- Download the
install.phpfile and upload it to thewp-contentfolder - Install WordPress -just do the 5-minutes install process
- Done!
- Don't use a 1-click install -you cannot use this script with them-
- Don't install WordPress BEFORE uploading the script
The script looks for default content in the wp-content/uploads folder for the default pages.
Thus when you'll upload the install.php file to the wp-content folder, you can also upload default content -e.g. cookies.txt- to the wp-content/uploads folder and the script will use that as default content for a page of the related type -e.g. page type cookies will look for content in wp-content/uploads/cookies.txt-.
This customization currently sets up the following features:
- Categories setup:
- Sets default category to be "General" instead of "Uncategorized"
- Pages setup:
- Sets the default content for the default page
- Sets the default page as the home page
- Creates a new page and sets it up as the blog page
- Sets the Privacy page -and tries to get the content from a "privacy.txt" file-
- Sets the Cookies page -and tries to get the content from a "cookies.txt" file-
- Sets the About page -and tries to get the content from a "about.txt" file-
- Sets the Contact page
- Sets default content from a
type.txtfor every page with typetype.- This feature helps set subsites up in a multisite
- Options setup:
- Enables de Welcome panel -this is specially useful when using this script as part of the multisite's new blog setup-
- Sets the permalink structure to post name -which imho is the most user-friendly permalink structure ever-
- Sets the language to Spanish
- Sets date&time formats to Spanish
- Sets the start of week to Monday
- Sets the timezone to "Europe/Madrid"
- Disables the year/month folder structure inside the uploads folder
- Disables smilies
@TODO
- Categories setup:
- Sets other categories
- Menus setup:
- Sets the main menu with:
- Homepage
- About page
- Blog page
- Contact page
- Sets the footer menu with:
- Legal Notice page
- Privacy page
- Cookies page
- Sets the main menu with:
- Options setup:
- Tie date&time formats to language selection
- Modify the 5-minutes install process form
- Add an Ubuntu-like timezone selector
- Add capabilities to get the default setup from git
- Connect to Gutenberg Hub to get default page templates
- My own Custom WordPress Installation -at GitLab-
- Some ideas from my WordPress VVV custom site template -at GitLab-
- Docs at WordPress Developer
add_menu_itemuseswp_update_nav_menu_item- Automatically download and activate plugins
This project is currently being developed, and works fine with WordPress 5.7.
Created by @borjalofe - feel free to contact me!