WP-CLI

WP-CLI is a powerful and extensible way to interact with WordPress from the command line. WP-CLI is supported on VIP as a beta feature via our VIP-CLI tool.

Most things you can do with WordPress core have an equivalent command in WP-CLI:

Getting Started

To get started, first install the latest version of VIP CLI:

npm i -g @automattic/vip

Interactive Shell

The easiest way to use WP-CLI is to use the interactive shell mode provided by VIP CLI. This feature provides a terminal-like interface into your WordPress site:

vip @my-site -- wp

my-site.production:~$ wp option get home
https://example.com
my-site.production:~$ wp cache delete my-cache-key my-cache-group
Success: Object deleted.
my-site.production:~$ 

Using the interactive shell mode is a convenient way to run multiple commands on the same environment and behaves much like a standard terminal or SSH session would.

Direct Commands

WP-CLI commands can also be run directly without the interactive shell mode, just like any normal command:

vip @my-site.production -- wp option get home
vip @my-site.staging -- wp post list --posts_per_page=100 --url=example.com/fr
vip @my-site.develop -- wp cache delete some-key

Running commands directly allows the output to be redirected and piped for creating powerful workflows and tools:

vip @my-site.develop -- wp user list --format=json | jq
vip @my-site.staging -- wp term list category --format=csv > category.csv

Note: In the examples above, the double dash (--) before wp separates arguments of the vip command from those of the wp command. You should always include them to avoid unexpected issues due to parameter conflicts.

Audit Log

For greater visibility into how WP-CLI is being used, the VIP Dashboard includes a log of all WP-CLI commands run on your applications and environments. To view the log, log in to the Dashboard and select “WP-CLI” when viewing an application.

Allowed Commands

As WP-CLI support is still in beta, only built-in commands are supported at this time. In the near future, we’ll be opening access to custom commands.

Here is the current list of supported commands:

wp cache add
wp cache decr
wp cache delete
wp cache get
wp cache incr
wp cache replace
wp cache set
wp cache type
wp cap (all)
wp cli version
wp comment approve
wp comment count
wp comment create
wp comment delete
wp comment exists
wp comment get
wp comment list
wp comment meta
wp comment recount
wp comment spam
wp comment status
wp comment trash
wp comment unapprove
wp comment unspam
wp comment untrash
wp comment update
wp core version
wp cron (all)
wp embed (all)
wp help (all)
wp language core activate
wp language core is-installed
wp language core list
wp language plugin is-installed
wp language plugin list
wp language theme is-installed
wp language theme list
wp media image-size
wp menu (all)
wp network (all)
wp option (all)
wp plugin activate
wp plugin deactivate
wp plugin get
wp plugin is-active
wp plugin is-installed
wp plugin list
wp plugin path
wp plugin search
wp plugin status
wp plugin toggle
wp plugin verify-checksums
wp post create
wp post delete
wp post exists
wp post get
wp post list
wp post meta
wp post term
wp post update
wp post-type (all)
wp rewrite (all)
wp role (all)
wp sidebar (all)
wp site activate
wp site archive
wp site create
wp site deactivate
wp site delete
wp site list
wp site mature
wp site meta
wp site option
wp site private
wp site public
wp site spam
wp site switch-language
wp site unarchive
wp site unmature
wp site unspam
wp super-admin (all)
wp taxonomy (all)
wp term create
wp term delete
wp term get
wp term list
wp term meta
wp term recount
wp term update
wp theme activate
wp theme disable
wp theme enable
wp theme get
wp theme is-active
wp theme is-installed
wp theme list
wp theme mod
wp theme path
wp theme search
wp theme status
wp transient (all)
wp user add-cap
wp user add-role
wp user check-password
wp user create
wp user delete
wp user get
wp user list
wp user list-caps
wp user meta
wp user remove-cap
wp user remove-role
wp user reset-password
wp user session
wp user set-role
wp user spam
wp user term
wp user unspam
wp user update
wp widget (all)
wp akismet check
wp akismet recheck_queue
wp akismet stats
wp jetpack get_stats
wp jetpack module
wp jetpack options
wp jetpack publicize
wp jetpack sitemap
wp jetpack status
wp jetpack test-connection

Images on VIP Go

VIP Go uses a service similar to Photon or WordPress.com images, so the core image processing is the same, and they all use (roughly) the same filters.

Intermediate images

Intermediate images are not stored on the file system, only the full size version is retained. In fact, the VIP Go Files Service can generate images custom sizes on the fly. In other words, when uploading an image, no thumbnaillarge, medium or other similar versions are generated.

This has the benefit of allowing a change to the application (e.g. a theme change) to completely change what crops, resizing, effects, etc are applied to the source images without having to process all source images to produce these intermediate images in advance. It all happens just in time as requests come in, are processed, and then cached on the VIP Go edge.

In order for the Service to work, constant WPCOM_VIP_USE_JETPACK_PHOTON must be set to true. The best way to achieve this is to add the following line in your vip-config/vip-config.php file:

define( 'WPCOM_VIP_USE_JETPACK_PHOTON', true );

Responsive Images

The VIP Go Files Service serves images with the srcset and sizes attributes to all images.  Example:

<img src="https://site.go-vip.co/wp-content/uploads/2018/09/image.jpg"
    sizes="(max-width: 660px) 100vw, 660px"
    srcset="https://site.go-vip.co/wp-content/uploads/2018/09/image.jpg 5472w, https://site.go-vip.co/wp-content/uploads/2018/09/image.jpg?resize=300,169 300w, https://site.go-vip.co/wp-content/uploads/2018/09/image.jpg?resize=768,432 768w,https://site.go-vip.co/wp-content/uploads/2018/09/image.jpg?resize=1024,5761024w"
    width="660"
    height="371" />

If you want to roll your own srcset implementation, you can disable our responsive images support by using this filter:

add_filter( 'vip_go_srcset_enabled', '__return_false' );

Upload File Size

The default maximum upload size for media files on VIP Go is 1GB. We can upload a file size of up to 2GB for specific use cases; if that’s something your team needs, please get in touch with your requirements and we’d be happy to help.

Image Manipulation and Transformation

VIP Go has the ability to handle image resizing, cropping, process successive transformation functions as Photon does. For example, you are now able to perform a crop followed by a resize function with a filter tacked on the end, as well as many other combinations.

For example:
https://ryanmarkel.com/wp-content/uploads/2011/07/cropped-5920665766_6c3e7258ac_o1.jpg?w=800&crop=100px,350px,450px,400px&resize=200,200&filter=sepia

VIP Go’s transformations are the same as Photon’s, and you can find documentation on the arguments here.

Note: transformation functions only operate on files in the uploads folder.

Remarks

  • VIP Go images serves files relative to the home_url of the site, so images will be on the same domain as your site. This is unlike Photon, that serves through a subdomain of wp.com (such as i1.wp.com).
  • VIP Go always has access to all images, so the cache can be updated without a request being made, which is unlike Photon.
  • Images do not live on the local file system, they are in a cloud distributed one. PHP functions that rely on local files will fail (file_exists(), filesize()).
  • VIP Go images can support HTTPS images.
  • If possible, we advise not to provide intermediate images when exporting content for a migration. This can make the export much smaller (up to 95% of the size can be saved), and the import proportionally quicker.

Ready to get started?

Drop us a note.

No matter where you are in the planning process, we’re happy to help, and we’re actual humans here on the other side of the form. 👋 We’re here to discuss your challenges and plans, evaluate your existing resources or a potential partner, or even make some initial recommendations. And, of course, we’re here to help any time you’re in the market for some robust WordPress awesomeness.