WP-CLI update date and time format

The wp-cli command structure would be: wp option update timezone_string “American/New_York” So: option to act on a WordPress option update to update the option the option name, in this case ‘timezone_string’ the new value, in this case ‘American/New_York’ Items 3 and 4 are defined by WordPress, a plugin, or other custom code. Number 4, the … Read more

Using wp-cli to Update WP Networks / Multisite from 3.5.1 to 3.8

For regular users, the preferred update method is pressing the “Update” button in wp-admin. For sysadmins, wp core update + wp core update-db will probably be a lot faster. Note that for multisite instances, you’ll have to update the DB for each site in the network. See https://github.com/wp-cli/wp-cli/issues/683 NB: I might be biased, since I’m … Read more

Can I create multiple pages at once using WP-CLI?

There are a few ways. As mentioned, post generate. wp post generate –count=10 –post_type=page –post_date=1999-01-04 curl http://loripsum.net/api/5 | wp post generate –post_content –count=10 You could write your own custom command. See the List of community commands for examples or the package index. <?php /** * Implements example command. */ class Example_Command extends WP_CLI_Command { /** … Read more

Remove all users from site except one using WP CLI

Found out you can pass the –exclude option to wp user list to exclude a user by their ID from the list. So let’s assume your user ID is 2 then you could do the following: wp user delete $(wp user list –field=ID –exclude=2) And just to be sure all content gets reassigned to you … Read more