The solution is in the shell
So I was stuck with logging in and manual upgrades untill I discovered WP-CLI. To use WP-CLI you need shell access. You have it on VPS hosting, and even some shared hostings offer it through some kind of web based shell emulator available in some cPannel and Plesk Pannel installations. Consider changing your webhosting if you want to use WP-CLI but can’t get shell access.
The installation is pretty straight forward: you just need to copy-paste some lines from the WP-CLI web page. If you want to have a server-wide installation, you need administration rights in the last step. It’s totaly worth asking your sysadmin to do it for you.
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar php wp-cli.phar --info chmod +x wp-cli.phar sudo mv wp-cli.phar /usr/local/bin/wp
Once you’ve done that, you’re ready to go. The upgrades are now much more simple: first you cd to your WordPress directory installation and then you execute two commands:
cd /path/to/wordpress wp core update wp core update-db
That’s all, you’ve done it. However, don’t forget to upgrade your plugins and your themes.
wp plugin update --all wp theme update --all
Ok, now you’re really ready for your next installation. Just repeat the above steps. Since all this are just shell commands, you can combine them in one simple bash script and make the complete upgrade in just one step.
1 2 3 4 5
#!/bin/bash wp core update wp core update-db wp plugin update --all wp theme update --all
Of course, if you know some bash scripting, you can be much more creative than this and make some really useful stuff. Let me know about it in the comments if you do.
New ways to install WordPress
If you need a new WordPress, forget about downloading, uploading and tweeking the wp-config.php file. You’re in controll now. Is your database created? Go to your server root and install WordPress in one minute
# First download the files. # If you have a cached version however it will grabe it. It will be even faster. wp core download # Configure database. wp core config --dbname=wp --dbuser=mojuser --dbpass=supergeslo123 --locale=sl_SI # Configure site meta and you're ready wp core install --url=example.com --title="My 382nd blog" --admin_user=janez --admin_password=supergeslo --firstname.lastname@example.org
In the second and third step, all possible known WordPress configuration options can be passed. The cryptographic salt strings, if not passed, are created as random strings by default.
You’re ready to write your blog by now, however you will probably want to add some plugins or change your theme. This is how you install and activate plugins and themes with WP-CLI:
wp plugin install wp-syntax wp plugin activate wp-syntax wp theme install hueman wp theme activate hueman # list of all installed plugins (works for themes too) wp plugin list +-----------+----------+-----------+---------+ | name | status | update | version | +-----------+----------+-----------+---------+ | akismet | inactive | available | 3.0.2 | | hello | inactive | none | 1.6 | | wp-syntax | active | none | 1.0 | +-----------+----------+-----------+---------+
It is so simple and easy to install themes with WP-CLI you must take care not to end up with thens of themes installed, but I really enjoy experimenting with themes since I use WP-CLI.