We’ve added WP-CLI support to the Premium version of our WP-Optimize Premium plugin.

WP-CLI is the command-line interface for WordPress that allows you to do all kinds of things, such as updating plugins and configuring multisite installs, without using a web browser.

Including it in WP-Optimize Premium means that you will now be able to run optimization commands directly on command-line. During this operation, WP-Oprtimize will perform in exactly the same way, but it will produce a detailed output on screen to show you what’s happening.

This feature is mainly for the experienced user, but it’s easy enough for anyone to set up and run. Here’s how it works:

  1. Before running an optimization, you will need to gather a list of optimizations available to you on command-line. To do this, you will need to run the following:

wp optimize optimizations

This will bring out the list of optimizations, as below:

optimizetables Optimise database tables
revisions Clean all post revisions
trash Clean all trashed posts
spam Remove spam and binned comments
unapproved Remove unapproved comments
attachments Remove orphaned attachments
transient Remove expired transient options
pingbacks Remove pingbacks
trackbacks Remove trackbacks
postmeta Clean post meta data
commentmeta Clean comment meta data
orphandata Clean orphaned relationship data
  1. When you have chosen your optimizations, you can then run them on the command-line (the example below uses the orphandata optimization):
wp optimize do-optimization --optimization-id=orphandata
  1. Once complete, the output will show something like this:

Success: 0 orphaned meta data deleted across 14 sites

You can also run multiple optimizations on command-line by placing a comma after each optimization (the example below uses both orphandata and revisions optimization);

Success: 0 orphaned meta data deleted across 14 sites

Success: 0 post revisions deleted across 14 sites

All Commands start with wp optimize and these are the full options available:

version To return the current WP-Optimize version.
optimization
Displays a full list of commands (as see up above) to optimize
do-optimization --optimization-id=
Running the selected optimization
--path=
Add this just after wp to specify the wordpress install e.g. wp –path=/var/www/html/work/multisite optimize do-optimization –optimization-id=orphandata

 

The post New Command-Line Feature for WP-Optimize appeared first on UpdraftPlus. UpdraftPlus – Backup, restore and migration plugin for WordPress.