{"id":4356,"date":"2018-07-29T16:00:07","date_gmt":"2018-07-29T23:00:07","guid":{"rendered":"https:\/\/kinsta.com\/?p=4356"},"modified":"2026-03-19T16:23:33","modified_gmt":"2026-03-19T16:23:33","slug":"wp-cli","status":"publish","type":"post","link":"https:\/\/kinsta.com\/blog\/wp-cli\/","title":{"rendered":"WP-CLI v2 &#8211; Managing WordPress From the Terminal"},"content":{"rendered":"<p>For most of its life, WordPress has been built using a simple code-base with a dash of object-oriented PHP being the most abstract system. In the past few years, however, this is changing for the better. From unit testing to CSS preprocessing and command line tools, more and more developer-friendly assets are popping up. In this article, we&#8217;ll look at one of my favorites: <a href=\"https:\/\/wp-cli.org\/\" target=\"_blank\" rel=\"noopener noreferrer\">WP-CLI<\/a>.<\/p>\n\n<div  class=\"featured-snippet\" id=\"featuredSnippet\">\n    <div class=\"featured-snippet__content\">\n        <h2>What is WP-CLI?<\/h2>\n        <div><p>WP-CLI is a <strong>command line tool<\/strong> for developers to manage common tasks (and not so common) of a WordPress installation. It can add\/remove users, posts, categories, insert test data, search and replace in the database, reset passwords, help troubleshoot performance issues, and much more!<\/p>\n<\/div>\n    <\/div>\n    <div class=\"featured-snippet__footer\">\n        <div class=\"arrow-down\"><\/div>\n        <div class=\"featured-snippet__footer--content row nocol middle-xs between-xs reverse\">\n            <div style=\"margin-left: auto; position: relative; top: -1px\" class=\"row nocol middle-xs\">\n                <div class=\"color--mediumGray\" style=\"font-size: 14px; vertical-align: middle;\">\n                    <svg  class=\"icon icon--logo display--block\" aria-hidden=\"true\" focusable=\"false\"><use xlink:href=\"https:\/\/kinsta.com\/wp-content\/themes\/kinsta\/dist\/sprite.svg?v=d7c088ac459b9cbb2e19b989209c747b#logo\" \/><\/svg>                <\/div>\n                <div class=\"text--bold color--mediumGray\" style=\"padding-left: 3px;\">Support<\/div>\n            <\/div>\n        <\/div>\n    <\/div>\n<\/div>\n\n<p>WP-CLI has been an open source project for over a decade, being maintained primarily by\u00a0<a href=\"https:\/\/profiles.wordpress.org\/danielbachhuber\" target=\"_blank\" rel=\"noopener noreferrer\">Daniel Bachhuber<\/a>\u00a0since 2003. The primary goal of WP-CLI is to help <strong>speed up WordPress developer&#8217;s workflows<\/strong>.<\/p>\n<p>Over the years the project has emerged into so much more! It&#8217;s now even becoming a requirement for other open source projects such as\u00a0<a href=\"https:\/\/kinsta.com\/blog\/bedrock-trellis\/\" target=\"_blank\" rel=\"noopener noreferrer\">Trellis and Bedrock<\/a>. As of January 2017, WP-CLI officially moved to WordPress.org and is also now being <a href=\"https:\/\/make.wordpress.org\/cli\/2017\/04\/03\/new-co-maintainer-alain-thanks-2017-sponsors\/\" target=\"_blank\" rel=\"noopener noreferrer\">co-maintained<\/a> by Alain\u00a0Schlesser.<\/p>\n<p><a href=\"https:\/\/make.wordpress.org\/cli\/2018\/08\/08\/wp-cli-v2-0-0-release-notes\/\" target=\"_blank\" rel=\"noopener noreferrer\">WP-CLI v2<\/a> was released on August 8th, 2018, so we&#8217;ll also explore some of the changes and new features. If you&#8217;re a Kinsta client, <strong>WP-CLI v2.0.1 is installed by default on all of our servers<\/strong>, simply <a href=\"https:\/\/kinsta.com\/blog\/how-to-use-ssh\/\" target=\"_blank\" rel=\"noopener noreferrer\">SSH into your server to get started<\/a>. SSH access is included in all of our hosting plans (Can&#8217;t connect via SSH? Fix the <a href=\"https:\/\/kinsta.com\/blog\/ssh-connection-refused\/\">SSH \u201cConnection Refused\u201d error<\/a>).<\/p>\n<ul>\n<li><a href=\"#getting-wp-cli\">Getting WP-CLI<\/a><\/li>\n<li><a href=\"#wp-cli-basics\">The Basics Of WP-CLI<\/a><\/li>\n<li><a href=\"#wp-cli-commands\">WP-CLI Commands in General<\/a><\/li>\n<li><a href=\"#useful-examples\">Useful Examples<\/a><\/li>\n<li><a href=\"#wp-cli-remotely\">Using WP-CLI Remotely<\/a><\/li>\n<li><a href=\"#using-bash-scripts\">Using Bash Scripts<\/a><\/li>\n<\/ul>\n<div><\/div><kinsta-auto-toc heading=\"Table of Contents\" exclude=\"last\" list-style=\"arrow\" selector=\"h2\" count-number=\"-1\"><\/kinsta-auto-toc>\n<h2 id=\"getting-wp-cli\">Getting WP-CLI<\/h2>\n<p>The minimum PHP requirement on WP-CLI v2.0.0 has been bumped up to PHP 5.4. While this is a good move ahead, we recommend that you at least run a <a href=\"https:\/\/kinsta.com\/blog\/php-versions\/\" target=\"_blank\" rel=\"noopener noreferrer\">supported version of PHP<\/a>, meaning 5.6 or higher. PHP 7.2 is the default on all Kinsta installs, both for security and performance reasons. We also have PHP 7.3 and 7.4 available.<\/p>\n<p>To get started you&#8217;ll need to install WP-CLI &#8211; a very simple process. The steps for Linux and OSX are the following, issue these three <a href=\"https:\/\/kinsta.com\/blog\/linux-commands\/\">commands<\/a> one after the other:<\/p>\n<pre><code>curl -O https:\/\/raw.githubusercontent.com\/wp-cli\/builds\/gh-pages\/phar\/wp-cli.phar\nchmod +x wp-cli.phar\nsudo mv wp-cli.phar \/usr\/local\/bin\/wp\n<\/code><\/pre>\n<p>If something goes wrong or you are on Windows refer to the <a href=\"http:\/\/wp-cli.org\/\" target=\"_blank\" rel=\"noopener noreferrer\">basic instructions<\/a> or the <a href=\"https:\/\/make.wordpress.org\/cli\/handbook\/installing\/#installing-on-windows\" target=\"_blank\" rel=\"noopener noreferrer\">alternative installation methods<\/a>.<\/p>\n<p>Once done you should be able to issue the <code>wp --info<\/code> command and get a meaningful response.<\/p>\n<p>The process is the same if you want to install WP-CLI on your server. Remember, for Kinsta clients WP-CLI is already installed. Not sure which version you&#8217;re currently running? You can always issue the <code>wp cli version<\/code> command to find out.<\/p>\n<h2 id=\"wp-cli-basics\">The Basics Of WP-CLI<\/h2>\n<p>Having access to <a href=\"https:\/\/kinsta.com\/blog\/ssh-commands\/\" target=\"_blank\" rel=\"noopener noreferrer\">WordPress from the command line is powerful<\/a> in and of itself but can give you even more control and speed gains when using bash scripts.<\/p>\n<p>Bash scripts allow you to run a sequence of commands with a single command. You could type <code>bash install-and-setup.sh<\/code> and get the following result:<\/p>\n<ul>\n<li>Download WordPress<\/li>\n<li>Create and populate <a href=\"https:\/\/kinsta.com\/blog\/wp-config-php\/\" target=\"_blank\" rel=\"noopener noreferrer\"><code>wp-config.php<\/code><\/a><\/li>\n<li>Create the database<\/li>\n<li>Install WordPress<\/li>\n<li>Install and activate any plugins you need<\/li>\n<li>Install and activate a theme<\/li>\n<li>Download and add test content<\/li>\n<\/ul>\n<p>These would be the steps I would take to create a new test environment for a project. Normally it would take me 5-10 minutes at least, especially if there are a few plugins involved. Issuing a single command is obviously a <strong>lot<\/strong> faster.<\/p>\n<h2 id=\"wp-cli-commands\">WP-CLI Commands in General<\/h2>\n<p>If you are used to working in the terminal there&#8217;s nothing special about WP-CLI for you. Commands always start with <code>wp<\/code> followed by a command and subcommand, followed by required and optional parameters, something like this:<\/p>\n<pre><code>wp command subcommand requiredparam --optionalparam --optionalparam2=value<\/code><\/pre>\n<p>Let&#8217;s <a href=\"https:\/\/kinsta.com\/blog\/how-to-install-a-wordpress-theme\/\">install a theme<\/a> to see how this works with a real command:<\/p>\n<pre><code>wp theme install twentyseventeen --activate<\/code><\/pre>\n<p>This will install and activate the <a href=\"https:\/\/kinsta.com\/blog\/twenty-seventeen-theme\/\" target=\"_blank\" rel=\"noopener noreferrer\">Twenty Seventeen theme<\/a> on your WordPress installation.<\/p>\n<p>Note that WP-CLI will work with the WordPress installation you are currently in the terminal. If you switch directories to go to another WordPress installation, it will work with that one.<\/p>\n<h2 id=\"useful-examples\">Useful Examples<\/h2>\n<p>That was WP-CLI in a nutshell! While there are a few advanced things you can do, which we&#8217;ll get to in a moment, you already know enough to get started and do whatever you need to. I recommend taking a look at the <a href=\"http:\/\/wp-cli.org\/commands\/\" target=\"_blank\" rel=\"noopener noreferrer\">commands list<\/a>, try some of them out. We&#8217;ll take a look at some useful stuff here, then move on to using WP-CLI over SSH and using bash scripts.<\/p>\n<h3>Installing WordPress<\/h3>\n<p>I use WP-CLI a lot to set up test environments, the first step of which is a vanilla installation. Here is a list of commands I run:<\/p>\n<pre><code>wp core download\nwp core config --dbname=mydbname --dbuser=mydbuser --dbpass=mydbpass --dbhost=localhost --dbprefix=whebfubwef_ --extra-php &lt;&lt;PHP\ndefine( 'WP_DEBUG', true );\ndefine( 'WP_DEBUG_LOG', true );\nPHP\nwp db create\nwp core install --url=http:\/\/siteurl.com --title=SiteTitle --admin_user=username --admin_password=mypassword --admin_email=my@email.com\n<\/code><\/pre>\n<p>Note how cool this is! The most recent version of WordPress is downloaded using the first command. The second command sets up the config file with the database access and some additional PHP at the end. The additional constants make sure we have our debugging options on for testing. We have a detailed guide here if you would like to <a href=\"https:\/\/kinsta.com\/blog\/wordpress-debug\/\" target=\"_blank\" rel=\"noopener noreferrer\">learn more about debugging WordPress<\/a>.<\/p>\n<p>The third command creates the <a href=\"https:\/\/kinsta.com\/blog\/wordpress-database\/\">database<\/a> (WP-CLI uses the database access info from the config file) and finally, we install WordPress using a couple of parameters.<\/p>\n<h3>Reinstall WordPress Core<\/h3>\n<p>You can also <a href=\"https:\/\/kinsta.com\/blog\/reinstall-wordpress\/\" target=\"_blank\" rel=\"noopener noreferrer\">reinstall WordPress<\/a> core using WP-CLI. The following command would download WordPress core without the default themes and plugins.<\/p>\n<pre>wp core download --skip-content --force<\/pre>\n<h3>Change WordPress URL<\/h3>\n<p>There are many reasons why you might need or want to <a href=\"https:\/\/kinsta.com\/blog\/wordpress-change-url\/\" target=\"_blank\" rel=\"noopener noreferrer\">change your WordPress URL<\/a>. Perhaps you are changing domains, moving to a <a href=\"https:\/\/kinsta.com\/blog\/wordpress-subdomain\/\">subdomain<\/a>, updating from www to non-www, moving files around, or even migrating from HTTP to HTTPS. Whatever the case may be, you can use easily use the <code>wp option update<\/code> command for this. Here is an example below:<\/p>\n<pre>wp option update home 'http:\/\/example.com'\nwp option update siteurl 'http:\/\/example.com'<\/pre>\n<h3>List of Current Plugins with Details<\/h3>\n<p>To get a list of current plugins installed on a site simply use the following command. In this example, you can see we have the Schema and Yoast SEO plugin installed. It will also return the status (active\/deactivated), if there is an update available, and the current version.<\/p>\n<pre>wp plugin list<\/pre>\n<figure id=\"attachment_18377\" aria-describedby=\"caption-attachment-18377\" style=\"width: 1180px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-18377\" src=\"https:\/\/kinsta.com\/wp-content\/uploads\/2018\/01\/wp-cli-plugin-list.png\" alt=\"WP-CLI plugin list\" width=\"1180\" height=\"294\" srcset=\"https:\/\/kinsta.com\/wp-content\/uploads\/2018\/01\/wp-cli-plugin-list.png 1180w, https:\/\/kinsta.com\/wp-content\/uploads\/2018\/01\/wp-cli-plugin-list-300x75.png 300w, https:\/\/kinsta.com\/wp-content\/uploads\/2018\/01\/wp-cli-plugin-list-768x191.png 768w, https:\/\/kinsta.com\/wp-content\/uploads\/2018\/01\/wp-cli-plugin-list-1024x255.png 1024w, https:\/\/kinsta.com\/wp-content\/uploads\/2018\/01\/wp-cli-plugin-list-610x152.png 610w\" sizes=\"auto, (max-width: 1180px) 100vw, 1180px\" \/><figcaption id=\"caption-attachment-18377\" class=\"wp-caption-text\">WP-CLI plugin list<\/figcaption><\/figure>\n<h3>Installing Multiple Plugins<\/h3>\n<p>To install multiple plugins you can simply pile on parameters. Here&#8217;s an example that downloads and activates 3 plugins:<\/p>\n<pre><code>wp plugin install advanced-custom-fields jetpack ninja-forms --activate<\/code><\/pre>\n<p>Note that the <strong>plugin names come from their name in the repository<\/strong>. The easiest way to figure this out is to visit their page and look at the URL or to use <code>wp plugin search searchterm<\/code> which will give you a list in the terminal.<\/p>\n<figure id=\"attachment_29544\" aria-describedby=\"caption-attachment-29544\" style=\"width: 1677px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-29544\" src=\"https:\/\/kinsta.com\/wp-content\/uploads\/2016\/05\/wordpress-plugin-repository-name.png\" alt=\"WordPress plugin repository URL\" width=\"1677\" height=\"1324\" srcset=\"https:\/\/kinsta.com\/wp-content\/uploads\/2016\/05\/wordpress-plugin-repository-name.png 1677w, https:\/\/kinsta.com\/wp-content\/uploads\/2016\/05\/wordpress-plugin-repository-name-300x237.png 300w, https:\/\/kinsta.com\/wp-content\/uploads\/2016\/05\/wordpress-plugin-repository-name-1024x808.png 1024w, https:\/\/kinsta.com\/wp-content\/uploads\/2016\/05\/wordpress-plugin-repository-name-768x606.png 768w, https:\/\/kinsta.com\/wp-content\/uploads\/2016\/05\/wordpress-plugin-repository-name-1536x1213.png 1536w\" sizes=\"auto, (max-width: 1677px) 100vw, 1677px\" \/><figcaption id=\"caption-attachment-29544\" class=\"wp-caption-text\">WordPress plugin repository URL<\/figcaption><\/figure>\n<p>You can also <a href=\"https:\/\/kinsta.com\/blog\/download-older-versions-of-wordpress-plugins\/\" target=\"_blank\" rel=\"noopener noreferrer\">install older versions of WordPress plugins<\/a> if needed with the <code>--version<\/code> attribute.<\/p>\n<pre>wp plugin install wordpress-seo --version=4.8 --activate<\/pre>\n<p>Even cooler, you can install plugins from remote files, not just the repository which is handy if you&#8217;re developing a plugin, or using a premium plugin. The following command installs two plugins from the repository and one from an Amazon S3 server.<\/p>\n<pre><code>wp plugin install advanced-custom-fields jetpack https:\/\/d1qas1txbec8n.cloudfront.net\/wp-content\/uploads\/2015\/06\/23073607\/myplugin.zip --activate<\/code><\/pre>\n<h3>Deactivate Multiple Plugins<\/h3>\n<p>To deactivate a single plugin you can run the following command.<\/p>\n<pre>wp plugin deactivate wordpress-seo<\/pre>\n<p>To deactivate all your plugins at once run the following command.<\/p>\n<pre>wp plugin deactivate --all<\/pre>\n<figure id=\"attachment_18379\" aria-describedby=\"caption-attachment-18379\" style=\"width: 1023px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-18379\" src=\"https:\/\/kinsta.com\/wp-content\/uploads\/2018\/01\/wp-cli-deactivate-all-plugins.png\" alt=\"WP-CLI deactivate all plugins\" width=\"1023\" height=\"161\" srcset=\"https:\/\/kinsta.com\/wp-content\/uploads\/2018\/01\/wp-cli-deactivate-all-plugins.png 1023w, https:\/\/kinsta.com\/wp-content\/uploads\/2018\/01\/wp-cli-deactivate-all-plugins-300x47.png 300w, https:\/\/kinsta.com\/wp-content\/uploads\/2018\/01\/wp-cli-deactivate-all-plugins-768x121.png 768w, https:\/\/kinsta.com\/wp-content\/uploads\/2018\/01\/wp-cli-deactivate-all-plugins-610x96.png 610w\" sizes=\"auto, (max-width: 1023px) 100vw, 1023px\" \/><figcaption id=\"caption-attachment-18379\" class=\"wp-caption-text\">WP-CLI deactivate all plugins<\/figcaption><\/figure>\n<p>This above command can be handy if you&#8217;re troubleshooting compatibility issues and simply need to deactivate all the plugins in one fell swoop. You can then go back and enable them one by one, testing as you go.<\/p>\n<h3>Update Plugins<\/h3>\n<p>You can also manually <a href=\"https:\/\/kinsta.com\/blog\/bulk-update-plugins-wordpress\/\">update WordPress plugins<\/a>. Example below:<\/p>\n<pre>wp plugin update wordpress-seo<\/pre>\n<figure id=\"attachment_11522\" aria-describedby=\"caption-attachment-11522\" style=\"width: 1498px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-11522\" src=\"https:\/\/kinsta.com\/wp-content\/uploads\/2017\/06\/wp-cli-manually-update-wordpress-plugin.png\" alt=\"wp-cli manually update wordpress plugin\" width=\"1498\" height=\"573\" srcset=\"https:\/\/kinsta.com\/wp-content\/uploads\/2017\/06\/wp-cli-manually-update-wordpress-plugin.png 1498w, https:\/\/kinsta.com\/wp-content\/uploads\/2017\/06\/wp-cli-manually-update-wordpress-plugin-300x115.png 300w, https:\/\/kinsta.com\/wp-content\/uploads\/2017\/06\/wp-cli-manually-update-wordpress-plugin-768x294.png 768w, https:\/\/kinsta.com\/wp-content\/uploads\/2017\/06\/wp-cli-manually-update-wordpress-plugin-1024x392.png 1024w, https:\/\/kinsta.com\/wp-content\/uploads\/2017\/06\/wp-cli-manually-update-wordpress-plugin-610x233.png 610w, https:\/\/kinsta.com\/wp-content\/uploads\/2017\/06\/wp-cli-manually-update-wordpress-plugin-460x176.png 460w\" sizes=\"auto, (max-width: 1498px) 100vw, 1498px\" \/><figcaption id=\"caption-attachment-11522\" class=\"wp-caption-text\">WP-CLI manually update WordPress plugin<\/figcaption><\/figure>\n<h3>Database Search And Replace<\/h3>\n<p>One of the main reasons it is difficult to migrate a site by just copy-pasting a database is that the database contains serialized arrays. If you need to replace all instances of <code>http:\/\/testsite.com<\/code> with <code>http:\/\/livewebsite.com<\/code> your serialized arrays will not make sense because the string count won&#8217;t match up.<\/p>\n<p>The <code>search-replace<\/code> command unserializes arrays first, then performs the <a href=\"https:\/\/kinsta.com\/blog\/wordpress-search-and-replace\/\" target=\"_blank\" rel=\"noopener noreferrer\">search and replace<\/a>, then re-serializes the arrays. You can get this done with a simple command:<\/p>\n<p><code>wp search-replace oldstring newstring<\/code><\/p>\n<p>Additional parameters allow you to do a lot more, including preview what will be replaced by using <code>--dry-run<\/code>.<\/p>\n<h3>Import And Export<\/h3>\n<p>There are two ways to export content with WP-CLI. You can create an XML file, just like the <a href=\"https:\/\/kinsta.com\/blog\/export-wordpress-site\/#built-in-tool\">WordPress export tool<\/a> does, or you can export\/import the raw database. I find the later a lot more useful in my daily routine, it comes in handy when syncing sites.<\/p>\n<p><code>wp db export<\/code> is all you need to do to create a SQL file and <code>wp db import file.sql<\/code> is all you need to import it. Works like a charm, just be careful not to overwrite anything you need, importing will basically dump the existing database and use the supplied SQL file instead.<\/p>\n<h3>Add, Update, Delete Users<\/h3>\n<p>You can add, update, and delete users with WP-CLI.<\/p>\n<pre><code># List user IDs\n$ wp user list --field=ID\n1\n\n# Create a new user.\n$ wp user create john john@example.com --role=author\nSuccess: Created user 3.\nPassword: HOh897%*(&^R8\n\n# Update an existing user.\n$ wp user update 123 --display_name=Beth --user_pass=bethpass\nSuccess: Updated user 123.\n\n# Delete user 123 and reassign posts to user 443\n$ wp user delete 123 --reassign=443\nSuccess: Removed user 123 from http:\/\/example.com<\/code><\/pre>\n<h3>Manage Roles And Capabilities<\/h3>\n<p>WP-CLI can manage roles for you pretty easily using the <code>wp role<\/code> command. This is pretty cool if you want to test how your plugin works with custom roles but you don&#8217;t actually create the roles within your plugin.<\/p>\n<pre><code>wp role create organizer Organizer\nwp cap list 'editor' | xargs wp cap add 'organizer'\nwp cap add 'organizer' 'manage-events'<\/code><\/pre>\n<p>The commands above will create a new role (Organizer), add all capabilities from the editor role to it and then add a new capability: manage-events. With the right commands you can use WP-CLI to <a href=\"https:\/\/kinsta.com\/blog\/change-wordpress-password\/\">change your WordPress password<\/a>.<\/p>\n<h3>Generate Test Data<\/h3>\n<p>I love all sort of faker-like functions &#8211; ones that add dummy content to your site that you can use for tests. WP-CLI has a couple of these built in, here are a few functions that will generate users, terms and posts.<\/p>\n<pre><code>wp user generate --count=5 --role=editor\nwp user generate --count=10 --role=author\nwp term generate --count=12\nwp post generate --count=50<\/code><\/pre>\n<h3>Manage WP-Cron Events<\/h3>\n<p>You can manage WP-Cron events and or a <a href=\"https:\/\/kinsta.com\/blog\/wordpress-cron-job\/\">WordPress Cron job<\/a> in\u00a0WP-CLI. For example, the following command will give you your current cron event list.<\/p>\n<pre>wp cron event list<\/pre>\n<figure id=\"attachment_9442\" aria-describedby=\"caption-attachment-9442\" style=\"width: 1281px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-9442 size-full\" src=\"https:\/\/kinsta.com\/wp-content\/uploads\/2017\/02\/wp-cron-event-list-2.png\" alt=\"wp-cron event list\" width=\"1281\" height=\"623\"><figcaption id=\"caption-attachment-9442\" class=\"wp-caption-text\">wp-cron event list<\/figcaption><\/figure>\n<h3>Delete Transients<\/h3>\n<p>You can even delete and clear out one or all transients using the following command.<\/p>\n<pre><code>wp transient delete --all<\/code><\/pre>\n<p>If you&#8217;re running <a href=\"https:\/\/kinsta.com\/blog\/wordpress-multisite\/\">multisite<\/a>, you&#8217;ll need a little more complicated command. By default, the command only checks the <code>wp_options<\/code> table. It doesn&#8217;t check for <code>wp_1_options<\/code>, <code>wp_2_options<\/code>, etc.<\/p>\n<pre><code>wp transient delete --all --network && wp site list --field=url | xargs -n1 -I % wp --url=% transient delete --all<\/code><\/pre>\n<h3>Clean up wp_options Table<\/h3>\n<p>The <a href=\"https:\/\/kinsta.com\/blog\/wp-options-autoloaded-data\/\" target=\"_blank\" rel=\"noopener noreferrer\">wp_options table<\/a> can be a common culprit for slow query times on your site due to autoloaded data that is left behind from third-party plugins and themes. Check out this great article from WP Bullet on <a href=\"https:\/\/guides.wp-bullet.com\/using-wp-cli-doctor-command-to-fix-large-wp_options-autoload-data\/\" target=\"_blank\" rel=\"noopener noreferrer\">how to use WP-CLI to clean up your wp_options table<\/a>.<\/p>\n<h3>Delete WordPress Revisions<\/h3>\n<p>On large sites, <a href=\"https:\/\/kinsta.com\/blog\/wordpress-revisions\/\" target=\"_blank\" rel=\"noopener noreferrer\">WordPress revisions<\/a> can add up very quickly to thousands of rows in your database which are not needed. You can delete post revisions with WP-CLI. Here is an example of the command:<\/p>\n<pre>$ wp post delete $(wp post list --post_type='revision' --format=ids)<\/pre>\n<figure id=\"attachment_29187\" aria-describedby=\"caption-attachment-29187\" style=\"width: 1354px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-29187 size-full\" src=\"https:\/\/kinsta.com\/wp-content\/uploads\/2017\/01\/wp-cli-delete-wordpress-revisions-1-1.jpg\" alt=\"wp-cli delete wordpress revisions\" width=\"1354\" height=\"339\"><figcaption id=\"caption-attachment-29187\" class=\"wp-caption-text\">WP-CLI delete WordPress revisions<\/figcaption><\/figure>\n<h3>Control Maintenance Mode<\/h3>\n<p>As of WP-CLI v2.2.0, you can now control the <a href=\"https:\/\/kinsta.com\/blog\/wordpress-maintenance-mode\/\">maintenance mode<\/a> on your WordPress site. Example:<\/p>\n<pre>wp maintenance-mode activate\nwp maintenance-mode deactivate\nwp maintenance-mode status<\/pre>\n<h3>Indexing Data with Elasticsearch<\/h3>\n<p><a href=\"https:\/\/kinsta.com\/blog\/wordpress-search\/\" target=\"_blank\" rel=\"noopener noreferrer\">Elasticsearch<\/a>\u00a0is an open-source full-text search engine. It is used to index data and search that data incredibly quickly. We offer this as an add-on for Kinsta clients. You can use <a href=\"https:\/\/github.com\/10up\/ElasticPress#wp-cli-commands\" target=\"_blank\" rel=\"noopener noreferrer\">ElasticPress WP-CLI commands<\/a> to perform indexing over SSH. Example:<\/p>\n<p><code>wp elasticpress index [--setup] [--network-wide] [--posts-per-page] [--nobulk] [--offset] [--show-bulk-errors] [--post-type]<\/code><\/p>\n<h3>Working with Multilingual Sites<\/h3>\n<p>WP-CLI v2.0.0 includes\u00a0a new family of commands\u00a0<code>wp i18n<\/code> for those of you working with <a href=\"https:\/\/kinsta.com\/blog\/wordpress-multilingual\/\" target=\"_blank\" rel=\"noopener noreferrer\">multilingual<\/a> sites. For example, you can\u00a0create a POT file for a WordPress plugin or theme.<\/p>\n<pre>wp i18n make-pot &lt;source&gt; [&lt;destination&gt;] [--slug=&lt;slug&gt;] [--domain=&lt;domain&gt;] [--ignore-domain] [--merge[=&lt;file&gt;]] [--exclude=&lt;paths&gt;] [--skip-js]<\/pre>\n<p>See <a href=\"https:\/\/github.com\/wp-cli\/i18n-command\" target=\"_blank\" rel=\"noopener noreferrer\">i18n-command documentation<\/a>.<\/p>\n<h3>Using WP-CLI with WooCommerce<\/h3>\n<p>Working with eCommerce sites?\u00a0\ud83d\uded2 We recommend checking Robot Ninja&#8217;s amazing <a href=\"https:\/\/robotninja.com\/blog\/wp-cli-woocommerce-development\/\" target=\"_blank\" rel=\"noopener noreferrer\">WP-CLI WooCommerce development guide<\/a> for quick and easy commands you can use. Generating a list of customers, orders, and even creating bulk products are all possible with WP-CLI.<\/p>\n<h2 id=\"wp-cli-remotely\">Using WP-CLI Remotely<\/h2>\n<p>One of the best things that you can do with WP-CLI is manage your remote WordPress installations. This is truly a website manager&#8217;s dream come true.<\/p>\n<p>To seamlessly run WP-CLI commands on a remote server via SSH you previously needed the wp-cli-ssh addon command. But as of <a href=\"http:\/\/wp-cli.org\/blog\/version-0.24.0.html\" target=\"_blank\" rel=\"noopener noreferrer\">v0.24.0<\/a>, this is now part of WP-CLI itself!\u00a0\ud83d\udc4f<\/p>\n<p><strong>Important:<\/strong> You need WP-CLI installed both on the computer you&#8217;re running the command from and your server.<\/p>\n<h3>Configuring Remote Servers<\/h3>\n<p>You can configure your servers globally or locally. To configure them globally use the\u00a0<code>config.yml<\/code> file. You can also use the <code>wp-cli.yml<\/code> or <code>wp-cli.local.yml<\/code> files in your current working directory.<\/p>\n<p>The configuration of servers works something like this, paste this in one of the mentioned files:<\/p>\n<pre><code>ssh:\n\n  staging:\n    cmd: ssh %pseudotty% username@server.com %cmd%\n    url: http:\/\/myseite.com\n    path: \/www\/path\/to\/site\/root<\/code><\/pre>\n<p>Once all this is done you can type the following command to update WordPress on your remote site:<\/p>\n<pre><code>wp ssh core update --host=staging<\/code><\/pre>\n<p>If you own or manage a lot of sites, I think you can see that this is amazing! The script will ask for a password, but if you use RSA keys to log in you can forgo that as well. Take a look at <a href=\"https:\/\/www.linuxhowtos.org\/Security\/SSH%20login%20without%20password.htm\" target=\"_blank\" rel=\"noopener noreferrer\">this article<\/a> to set that up.<\/p>\n<h2 id=\"using-bash-scripts\">Using Bash Scripts<\/h2>\n<p>Bash scripts save you even more time by automating tasks. Remember how we needed to type a lot of commands to install WordPress? You can do that with a single bash script. Inside a directory create an <code>install.sh<\/code> file. Paste the same code we had before inside and save it.<\/p>\n<pre><code>wp core download\nwp core config --dbname=mydbname --dbuser=mydbuser --dbpass=mydbpass --dbhost=localhost --dbprefix=whebfubwef_ --extra-php &lt;&lt;PHP\ndefine( 'WP_DEBUG', true );\ndefine( 'WP_DEBUG_LOG', true );\nPHP\nwp db create\nwp core install --url=http:\/\/siteurl.com --title=SiteTitle --admin_user=username --admin_password=mypassword --admin_email=my@email.com<\/code><\/pre>\n<p>All you need to do now is type <code>bash install.sh<\/code> and everything will be done for you, without user intervention. If you manage a lot of sites you can set up all your environments and create a bash script like this:<\/p>\n<pre><code>wp ssh core update --host=clientA\nwp ssh core update --host=clientB\nwp ssh core update --host=clientC\nwp ssh core update --host=clientD<\/code><\/pre>\n<p>When a new WordPress version comes out, this could save you a <strong>lot<\/strong> of time! Since you can do anything you like with WP-CLI you can even update themes and plugins regularly on a number of client sites at once.<\/p>\n<h2>Summary<\/h2>\n<p>WP-CLI really is the developer and website manager&#8217;s dream come true. As developers we can create test sites in a jiffy, add test content and do all sorts of <a href=\"https:\/\/kinsta.com\/blog\/wordpress-export-users\/\">import\/export<\/a> magic. Site managers can handle site updates and other tasks for multiple sites with single commands. Make sure to check out the <a href=\"https:\/\/make.wordpress.org\/cli\/2018\/08\/08\/wp-cli-v2-0-0-release-notes\/\" target=\"_blank\" rel=\"noopener noreferrer\">WP-CLI v2 release notes<\/a>!<\/p>\n<p>If you haven&#8217;t already tried WP-CLI I urge you to give it a go. There are also a bunch of <a href=\"https:\/\/make.wordpress.org\/cli\/handbook\/tools\/\" target=\"_blank\" rel=\"noopener noreferrer\">community commands<\/a> like WP-CLI-SSH which add even more great features! If you&#8217;re running into problems, make sure to check out the <a href=\"https:\/\/make.wordpress.org\/cli\/handbook\/common-issues\/\" target=\"_blank\" rel=\"noopener noreferrer\">WP-CLI common issues documentation<\/a>.<\/p>\n<p>Don&#8217;t forget that Kinsta&#8217;s powerful architecture supports WP-CLI out of the box. If you&#8217;d like to try the most modern <a href=\"https:\/\/kinsta.com\/wordpress-hosting\/\" target=\"_blank\" rel=\"noopener noreferrer\">WordPress hosting architecture<\/a> and have access to great tools like WP-CLI, try our managed WordPress hosting.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>For most of its life, WordPress has been built using a simple code-base with a dash of object-oriented PHP being the most abstract system. In the &#8230;<\/p>\n","protected":false},"author":18,"featured_media":29532,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"wl_entities_gutenberg":"","_kinsta_gated_content":false,"_kinsta_gated_content_redirect":"","footnotes":""},"tags":[443,476],"topic":[22023],"wl_entity_type":[20901],"class_list":["post-4356","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","tag-webdev","tag-wpcli","topic-wordpress-development","wl_entity_type-article"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v24.6 (Yoast SEO v24.6) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>WP-CLI v2 \u2013 Managing WordPress From the Terminal<\/title>\n<meta name=\"description\" content=\"WP-CLI v2 is a powerful command line tool for developers to manage WordPress installations. Check out how to install and use WP-CLI commands.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/kinsta.com\/blog\/wp-cli\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"WP-CLI v2 - Managing WordPress From the Terminal\" \/>\n<meta property=\"og:description\" content=\"WP-CLI v2 is a powerful command line tool for developers to manage WordPress installations. Check out how to install and use WP-CLI commands.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/kinsta.com\/blog\/wp-cli\/\" \/>\n<meta property=\"og:site_name\" content=\"Kinsta\u00ae\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/kinstahosting\" \/>\n<meta property=\"article:published_time\" content=\"2018-07-29T23:00:07+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-03-19T16:23:33+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/kinsta.com\/wp-content\/uploads\/2016\/05\/wp-cli-v2.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1460\" \/>\n\t<meta property=\"og:image:height\" content=\"730\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Daniel Pataki\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:description\" content=\"WP-CLI v2 is a powerful command line tool for developers to manage WordPress installations. Check out how to install and use WP-CLI commands.\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/kinsta.com\/wp-content\/uploads\/2016\/05\/wp-cli-v2.png\" \/>\n<meta name=\"twitter:creator\" content=\"@danielpataki\" \/>\n<meta name=\"twitter:site\" content=\"@kinsta\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Daniel Pataki\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"12 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/kinsta.com\/blog\/wp-cli\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/kinsta.com\/blog\/wp-cli\/\"},\"author\":{\"name\":\"Daniel Pataki\",\"@id\":\"https:\/\/kinsta.com\/#\/schema\/person\/b162216499225e1a4cdd35518f8ef0ff\"},\"headline\":\"WP-CLI v2 &#8211; Managing WordPress From the Terminal\",\"datePublished\":\"2018-07-29T23:00:07+00:00\",\"dateModified\":\"2026-03-19T16:23:33+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/kinsta.com\/blog\/wp-cli\/\"},\"wordCount\":2322,\"commentCount\":4,\"publisher\":{\"@id\":\"https:\/\/kinsta.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/kinsta.com\/blog\/wp-cli\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/kinsta.com\/wp-content\/uploads\/2016\/05\/wp-cli-v2.png\",\"keywords\":[\"webdev\",\"WPCLI\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/kinsta.com\/blog\/wp-cli\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/kinsta.com\/blog\/wp-cli\/\",\"url\":\"https:\/\/kinsta.com\/blog\/wp-cli\/\",\"name\":\"WP-CLI v2 \u2013 Managing WordPress From the Terminal\",\"isPartOf\":{\"@id\":\"https:\/\/kinsta.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/kinsta.com\/blog\/wp-cli\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/kinsta.com\/blog\/wp-cli\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/kinsta.com\/wp-content\/uploads\/2016\/05\/wp-cli-v2.png\",\"datePublished\":\"2018-07-29T23:00:07+00:00\",\"dateModified\":\"2026-03-19T16:23:33+00:00\",\"description\":\"WP-CLI v2 is a powerful command line tool for developers to manage WordPress installations. Check out how to install and use WP-CLI commands.\",\"breadcrumb\":{\"@id\":\"https:\/\/kinsta.com\/blog\/wp-cli\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/kinsta.com\/blog\/wp-cli\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/kinsta.com\/blog\/wp-cli\/#primaryimage\",\"url\":\"https:\/\/kinsta.com\/wp-content\/uploads\/2016\/05\/wp-cli-v2.png\",\"contentUrl\":\"https:\/\/kinsta.com\/wp-content\/uploads\/2016\/05\/wp-cli-v2.png\",\"width\":1460,\"height\":730,\"caption\":\"WP-CLI v2\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/kinsta.com\/blog\/wp-cli\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/kinsta.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"WordPress Development\",\"item\":\"https:\/\/kinsta.com\/topic\/wordpress-development\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"WP-CLI v2 &#8211; Managing WordPress From the Terminal\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/kinsta.com\/#website\",\"url\":\"https:\/\/kinsta.com\/\",\"name\":\"Kinsta\u00ae\",\"description\":\"Kinsta: Simply better hosting.\",\"publisher\":{\"@id\":\"https:\/\/kinsta.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/kinsta.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/kinsta.com\/#organization\",\"name\":\"Kinsta\",\"alternateName\":\"Kinsta Inc, Kinsta Ltd\",\"url\":\"https:\/\/kinsta.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/kinsta.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/kinsta.com\/wp-content\/uploads\/2023\/12\/kinsta-logo.jpeg\",\"contentUrl\":\"https:\/\/kinsta.com\/wp-content\/uploads\/2023\/12\/kinsta-logo.jpeg\",\"width\":500,\"height\":500,\"caption\":\"Kinsta\"},\"image\":{\"@id\":\"https:\/\/kinsta.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/kinstahosting\",\"https:\/\/x.com\/kinsta\",\"https:\/\/www.instagram.com\/kinstahosting\/\",\"https:\/\/www.linkedin.com\/company\/kinsta\/\",\"https:\/\/www.pinterest.com\/kinstahosting\/\",\"https:\/\/www.youtube.com\/Kinsta\",\"https:\/\/www.crunchbase.com\/organization\/kinsta-wordpress-hosting\",\"https:\/\/www.wikidata.org\/wiki\/Q106594994\"],\"description\":\"Kinsta: Simply better hosting for WordPress. Fast, secure, scalable, and backed by world-class support. Built to power your growth.\",\"email\":\"contact@kinsta.com\",\"telephone\":\"+1 (888) 610-2915\",\"legalName\":\"Kinsta Inc.\",\"foundingDate\":\"2013-12-01\",\"numberOfEmployees\":{\"@type\":\"QuantitativeValue\",\"minValue\":\"201\",\"maxValue\":\"500\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/kinsta.com\/#\/schema\/person\/b162216499225e1a4cdd35518f8ef0ff\",\"name\":\"Daniel Pataki\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/kinsta.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/2a44c1ab807766aeaa5c8d76d4c5ea66?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/2a44c1ab807766aeaa5c8d76d4c5ea66?s=96&d=mm&r=g\",\"caption\":\"Daniel Pataki\"},\"description\":\"Hi, my name is Daniel, I'm the CTO here at Kinsta. You may know me from Smashing Magazine, WPMU Dev, Tuts+ and other WordPress\/Development magazines. Aside from WordPress and PHP I spend most of my time around Node, React, GraphQL and other technologies in the Javascript space. When not working on making the best hosting solution in the Universe I collect board games, play table football in the office, travel or play guitar and sing in a pretty bad band.\",\"sameAs\":[\"http:\/\/danielpataki.com\",\"https:\/\/x.com\/danielpataki\"],\"url\":\"https:\/\/kinsta.com\/blog\/author\/danielpataki\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"WP-CLI v2 \u2013 Managing WordPress From the Terminal","description":"WP-CLI v2 is a powerful command line tool for developers to manage WordPress installations. Check out how to install and use WP-CLI commands.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/kinsta.com\/blog\/wp-cli\/","og_locale":"en_US","og_type":"article","og_title":"WP-CLI v2 - Managing WordPress From the Terminal","og_description":"WP-CLI v2 is a powerful command line tool for developers to manage WordPress installations. Check out how to install and use WP-CLI commands.","og_url":"https:\/\/kinsta.com\/blog\/wp-cli\/","og_site_name":"Kinsta\u00ae","article_publisher":"https:\/\/www.facebook.com\/kinstahosting","article_published_time":"2018-07-29T23:00:07+00:00","article_modified_time":"2026-03-19T16:23:33+00:00","og_image":[{"width":1460,"height":730,"url":"https:\/\/kinsta.com\/wp-content\/uploads\/2016\/05\/wp-cli-v2.png","type":"image\/png"}],"author":"Daniel Pataki","twitter_card":"summary_large_image","twitter_description":"WP-CLI v2 is a powerful command line tool for developers to manage WordPress installations. Check out how to install and use WP-CLI commands.","twitter_image":"https:\/\/kinsta.com\/wp-content\/uploads\/2016\/05\/wp-cli-v2.png","twitter_creator":"@danielpataki","twitter_site":"@kinsta","twitter_misc":{"Written by":"Daniel Pataki","Est. reading time":"12 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/kinsta.com\/blog\/wp-cli\/#article","isPartOf":{"@id":"https:\/\/kinsta.com\/blog\/wp-cli\/"},"author":{"name":"Daniel Pataki","@id":"https:\/\/kinsta.com\/#\/schema\/person\/b162216499225e1a4cdd35518f8ef0ff"},"headline":"WP-CLI v2 &#8211; Managing WordPress From the Terminal","datePublished":"2018-07-29T23:00:07+00:00","dateModified":"2026-03-19T16:23:33+00:00","mainEntityOfPage":{"@id":"https:\/\/kinsta.com\/blog\/wp-cli\/"},"wordCount":2322,"commentCount":4,"publisher":{"@id":"https:\/\/kinsta.com\/#organization"},"image":{"@id":"https:\/\/kinsta.com\/blog\/wp-cli\/#primaryimage"},"thumbnailUrl":"https:\/\/kinsta.com\/wp-content\/uploads\/2016\/05\/wp-cli-v2.png","keywords":["webdev","WPCLI"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/kinsta.com\/blog\/wp-cli\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/kinsta.com\/blog\/wp-cli\/","url":"https:\/\/kinsta.com\/blog\/wp-cli\/","name":"WP-CLI v2 \u2013 Managing WordPress From the Terminal","isPartOf":{"@id":"https:\/\/kinsta.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/kinsta.com\/blog\/wp-cli\/#primaryimage"},"image":{"@id":"https:\/\/kinsta.com\/blog\/wp-cli\/#primaryimage"},"thumbnailUrl":"https:\/\/kinsta.com\/wp-content\/uploads\/2016\/05\/wp-cli-v2.png","datePublished":"2018-07-29T23:00:07+00:00","dateModified":"2026-03-19T16:23:33+00:00","description":"WP-CLI v2 is a powerful command line tool for developers to manage WordPress installations. Check out how to install and use WP-CLI commands.","breadcrumb":{"@id":"https:\/\/kinsta.com\/blog\/wp-cli\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/kinsta.com\/blog\/wp-cli\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/kinsta.com\/blog\/wp-cli\/#primaryimage","url":"https:\/\/kinsta.com\/wp-content\/uploads\/2016\/05\/wp-cli-v2.png","contentUrl":"https:\/\/kinsta.com\/wp-content\/uploads\/2016\/05\/wp-cli-v2.png","width":1460,"height":730,"caption":"WP-CLI v2"},{"@type":"BreadcrumbList","@id":"https:\/\/kinsta.com\/blog\/wp-cli\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/kinsta.com\/"},{"@type":"ListItem","position":2,"name":"WordPress Development","item":"https:\/\/kinsta.com\/topic\/wordpress-development\/"},{"@type":"ListItem","position":3,"name":"WP-CLI v2 &#8211; Managing WordPress From the Terminal"}]},{"@type":"WebSite","@id":"https:\/\/kinsta.com\/#website","url":"https:\/\/kinsta.com\/","name":"Kinsta\u00ae","description":"Kinsta: Simply better hosting.","publisher":{"@id":"https:\/\/kinsta.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/kinsta.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/kinsta.com\/#organization","name":"Kinsta","alternateName":"Kinsta Inc, Kinsta Ltd","url":"https:\/\/kinsta.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/kinsta.com\/#\/schema\/logo\/image\/","url":"https:\/\/kinsta.com\/wp-content\/uploads\/2023\/12\/kinsta-logo.jpeg","contentUrl":"https:\/\/kinsta.com\/wp-content\/uploads\/2023\/12\/kinsta-logo.jpeg","width":500,"height":500,"caption":"Kinsta"},"image":{"@id":"https:\/\/kinsta.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/kinstahosting","https:\/\/x.com\/kinsta","https:\/\/www.instagram.com\/kinstahosting\/","https:\/\/www.linkedin.com\/company\/kinsta\/","https:\/\/www.pinterest.com\/kinstahosting\/","https:\/\/www.youtube.com\/Kinsta","https:\/\/www.crunchbase.com\/organization\/kinsta-wordpress-hosting","https:\/\/www.wikidata.org\/wiki\/Q106594994"],"description":"Kinsta: Simply better hosting for WordPress. Fast, secure, scalable, and backed by world-class support. Built to power your growth.","email":"contact@kinsta.com","telephone":"+1 (888) 610-2915","legalName":"Kinsta Inc.","foundingDate":"2013-12-01","numberOfEmployees":{"@type":"QuantitativeValue","minValue":"201","maxValue":"500"}},{"@type":"Person","@id":"https:\/\/kinsta.com\/#\/schema\/person\/b162216499225e1a4cdd35518f8ef0ff","name":"Daniel Pataki","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/kinsta.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/2a44c1ab807766aeaa5c8d76d4c5ea66?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/2a44c1ab807766aeaa5c8d76d4c5ea66?s=96&d=mm&r=g","caption":"Daniel Pataki"},"description":"Hi, my name is Daniel, I'm the CTO here at Kinsta. You may know me from Smashing Magazine, WPMU Dev, Tuts+ and other WordPress\/Development magazines. Aside from WordPress and PHP I spend most of my time around Node, React, GraphQL and other technologies in the Javascript space. When not working on making the best hosting solution in the Universe I collect board games, play table football in the office, travel or play guitar and sing in a pretty bad band.","sameAs":["http:\/\/danielpataki.com","https:\/\/x.com\/danielpataki"],"url":"https:\/\/kinsta.com\/blog\/author\/danielpataki\/"}]}},"_wl_alt_label":[],"wl:entity_url":"http:\/\/data.wordlift.io\/wl0150038\/post\/wp-cli_v2_-_managing_wordpress_from_the_terminal","_links":{"self":[{"href":"https:\/\/kinsta.com\/wp-json\/wp\/v2\/posts\/4356","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kinsta.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kinsta.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kinsta.com\/wp-json\/wp\/v2\/users\/18"}],"replies":[{"embeddable":true,"href":"https:\/\/kinsta.com\/wp-json\/wp\/v2\/comments?post=4356"}],"version-history":[{"count":20,"href":"https:\/\/kinsta.com\/wp-json\/wp\/v2\/posts\/4356\/revisions"}],"predecessor-version":[{"id":207770,"href":"https:\/\/kinsta.com\/wp-json\/wp\/v2\/posts\/4356\/revisions\/207770"}],"alternate":[{"embeddable":true,"hreflang":"es","title":"Spanish","href":"https:\/\/kinsta.com\/wp-json\/kinsta\/v1\/posts\/4356\/translations\/es"},{"embeddable":true,"hreflang":"en","title":"English","href":"https:\/\/kinsta.com\/wp-json\/kinsta\/v1\/posts\/4356\/translations\/en"},{"embeddable":true,"hreflang":"it","title":"Italian","href":"https:\/\/kinsta.com\/wp-json\/kinsta\/v1\/posts\/4356\/translations\/it"},{"embeddable":true,"hreflang":"fr","title":"French","href":"https:\/\/kinsta.com\/wp-json\/kinsta\/v1\/posts\/4356\/translations\/fr"},{"embeddable":true,"hreflang":"nl","title":"Dutch","href":"https:\/\/kinsta.com\/wp-json\/kinsta\/v1\/posts\/4356\/translations\/nl"},{"embeddable":true,"hreflang":"pt","title":"Portuguese","href":"https:\/\/kinsta.com\/wp-json\/kinsta\/v1\/posts\/4356\/translations\/pt"},{"embeddable":true,"hreflang":"de","title":"German","href":"https:\/\/kinsta.com\/wp-json\/kinsta\/v1\/posts\/4356\/translations\/de"},{"embeddable":true,"hreflang":"sv","title":null,"href":"https:\/\/kinsta.com\/wp-json\/kinsta\/v1\/posts\/4356\/translations\/se"},{"embeddable":true,"hreflang":"ja","title":"Japanese","href":"https:\/\/kinsta.com\/wp-json\/kinsta\/v1\/posts\/4356\/translations\/jp"},{"embeddable":true,"hreflang":"da","title":null,"href":"https:\/\/kinsta.com\/wp-json\/kinsta\/v1\/posts\/4356\/translations\/dk"},{"href":"https:\/\/kinsta.com\/wp-json\/kinsta\/v1\/posts\/4356\/tree"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kinsta.com\/wp-json\/wp\/v2\/media\/29532"}],"wp:attachment":[{"href":"https:\/\/kinsta.com\/wp-json\/wp\/v2\/media?parent=4356"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kinsta.com\/wp-json\/wp\/v2\/tags?post=4356"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/kinsta.com\/wp-json\/wp\/v2\/topic?post=4356"},{"taxonomy":"wl_entity_type","embeddable":true,"href":"https:\/\/kinsta.com\/wp-json\/wp\/v2\/wl_entity_type?post=4356"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}