10 Ways WP-CLI Can Speed Up WordPress Development
WP-CLI is a useful time-saving tool for WordPress developers and advanced WordPress users. However, if you’ve never used this command line package before, it can be a little intimidating to get started.
Most of us learn best by doing, so that’s what we’re going to do with this tutorial. That way, you can see WP-CLI in action and get a feel for what it’s like to use this powerful tool.
In this post, we’ll walk through 10 of the most useful things you can do with WP-CLI. Follow along, and by the end of the post, you’ll have a strong working knowledge of how to use WP-CLI to get things done quickly.Getting Started with WP-CLI
The first thing you’ll need to do is find a place to use WP-CLI . Many hosts offer WP-CLI preinstalled on their servers ― especially if they target the WordPress ecosystem. That means that the easiest way to get started with WP-CLI is usually to SSH to your web server and just start typing commands.
If you find that you do you need to install WP-CLI , it can be installed on any UNIX-like environment. So it runs fine on all linux web servers and can even be user-installed on many cheap shared hosting accounts with minimal fuss. It can also be installed on OS X and windows, although some features may not work on Windows and you can expect it to be a little harder to get WP-CLI up and running on Windows.
Once you have WP-CLI up and running in the environment where you want to use it the environment where your WordPress install will live you’re ready to start typing commands.Site Setup
The first thing you can do with WP-CLI is set up a new WordPress installation. Let’s do that now.1. Install WordPress
You use the wp core command to download, install, and update a WordPress installation. To use it, you need to first get into the directory where WordPress will be installed.
I created a new directory called /wp-cli/ and set it up to resolve as a subdomain of my personal website: http://wp-cli.jonpenland.com . So, to install WordPress at this location, I first moved to the appropriate directory with the command cd ~/public-html/wp-cli and then used the following WP-CLI command to download WordPress:
Next, you’ll need to create a database. Your host may or may not give you a way to do this over SSH. Either create a database over SSH with the create database command, or log into your hosting account and create a new database using another host-provided tool like a mysql database creation wizard orphpMyAdmin.
Once your database is ready, head back to the command line. You’re ready to set up wp-config.php with this command:
This command will create a configuration file that includes the details you provide. Use the database name, user, and password you created previously, your database host (probably localhost), and a database table prefix. The default prefix is wp_ , but you’ll probably want to make it something unique like xyz_ . Then just run the command.
The last step is to run the WordPress installation script, which you can do with this command:
本文开发（php）相关术语:php代码审计工具 php开发工程师 移动开发者大会 移动互联网开发 web开发工程师 软件开发流程 软件开发工程师
本文标题：10 Ways WP-CLI Can Speed Up WordPress Development