Search This Blog
Popular Posts
-
Elegant Themes has been developing WordPress themes for a long time. It has developed lots of popular themes including Divi, Nexus, Fa...
-
This is part of our "Learn WordPress" series. In this post, you will find out how to properly set up WordPress after creati...
-
It has not only changed the traditional perspective of buyers and sellers, but also revolutionized the entire concept of retail busine...
-
Hello there! My blog post 'Spikes' was published on Sept. 22nd; however, the post before it called 'Flow' was published on...
-
WordPress has rolled out a new version dubbed 4.2.3 of its content management system (CMS) to patch a critical cross-site scripting (XSS) vu...
-
By Myolisi Sikupela: Staff Reporter on 25 February, 2016 WordPress has announced that it now supports Accelerated Mobile Page...
-
LIST MAG WP is a beautifully designed WordPress Theme that is built to be engaging, fast and most importantly boost viral traffic with...
-
Lifegate is a modern looking and elegant WordPress Blog Theme with plenty of straightforward and complete functionalities to build up a pe...
-
The United States government earlier this year officially accused Russia of interfering with the US elections. Earlier this year on Octo...
-
What comes to mind when you hear of WordPress? For a majority of people, blogging comes to mind. To other people who are professionals in we...
Blog Archive
- December (18)
- November (29)
- October (27)
- September (29)
- August (31)
- July (30)
- June (29)
- May (29)
- April (30)
- March (31)
- February (28)
- January (31)
- December (31)
- November (30)
- October (31)
- September (30)
- August (43)
- July (42)
- June (33)
- May (43)
- April (36)
- March (37)
- February (31)
- January (4)
- December (1)
- November (1)
- October (24)
- September (24)
- August (25)
- July (28)
- June (18)
- September (1)
Total Pageviews
Blogroll
Automate WordPress Management Tasks with WP-CLI
This is the first in a series of tutorials designed to help make your WordPress efforts more easily manageable by using WP-CLI.
WordPress Command Line Interface, or WP-CLI, is a simple but powerful command line tool that when used right, can simplify most tasks required to run a successful WordPress website. For example, with WP-CLI you can upgrade "WordPress core" or install a plugin with a single command, no logins and clicks necessary! Your WordPress site will feel like a well-oiled machine.

In this series of blog posts, we will cover the basic but useful tasks with WP-CLI such as upgrading WordPress core and managing your plugins. By the end of it, you'll be comfortable using WP-CLI and discovering even more ways you can use it to simplify your life!
Installing and configuring WP-CLIIf you are using DreamPress or have WordPress installed on a shared, VPS, or dedicated hosting account with us, you can just log in to the server and you'll find WP-CLI waiting for your commands. Login to your remote server and check it out:
[user@dreamhost-server]$ wp --infoWP-CLI needs the path where the WordPress installation lives to get started. The easiest way is by providing the path in the command line. For example, if you have one WordPress site installed in /home/user/domain, the command to check WordPress version should be:
[user@server] $ wp --path=/home/user/domain core versionIf you only run one domain, you can enter the path in a YAML file, storing path and all the most used options there. Add this line to your ~/.wp-cli/config.yml config file:
path: "/home/username/domain"After you have added this to your config file, run the following to confirm your path is correct:
[user@server]$ wp core versionThis shows the version number of your WordPress install. If it succeeds, your path is configured correctly; if it does not, check your path again to make sure there are no typos.
If you manage multiple WordPress sites, it might be easiest to install WP-CLI locally and configure it to manage multiple sites. If you are on MacOS and have brew installed, you can use it to install wp-cli using the following:
[user@localhost] $ brew install wp-cliOtherwise, install PHP, then download WP-CLI so you can run it locally.
[user@localhost] $ curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar [user@localhost] $ chmod +x wp-cli.phar [user@localhost] $ ln -s wp-cli.phar wpMake sure WP-CLI can run with the following:
[user@localhost] $ ./wp --infoNow you need to configure WP-CLI to manage multiple sites, using the ~/.wp-cli/config.yml config file. For example, let's assume you have a production website on a server named prod.example.com with WordPress, in the path /home/example/prod.example.com; you also have a staging site at staging.example.com with WordPress in the path /home/example/staging.example.com and each site's ssh user is example. In the YAML configuration file you'll create two alias entries, @prod and @staging like in the example below:
@prod: user: example ssh: prod.example.com path: "/home/example/prod.example.com" @staging: user: example ssh: staging.example.com path: "/home/example/staging.example.com"Then when you want to run commands against the production site, you would use the @prod aliases to pass commands to the appropriate server:
[user@localhost] $ ./wp @prod core versionAnd to reach the staging server, use @staging alias:
[user@localhost] $ ./wp @staging core versionIf you manage production and staging WordPress sites for multiple customers, you can see how handy that is—for example, you can upgrade all WordPress sites to a new release from your own computer, no extra clicks necessary!
In the next episode, we'll show you how to manage your WordPress core version using a handy terminal application. Stay tuned!
Have questions? Leave a comment below, or chat with us on Twitter @DreamHostCare!
Source: Automate WordPress Management Tasks with WP-CLI
0 comments:
Post a Comment