未加星标

10 Ways WP-CLI Can Speed Up WordPress Development

字体大小 | |
[开发(php) 所属分类 开发(php) | 发布者 店小二04 | 时间 2017 | 作者 红领巾 ] 0人收藏点击收藏

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开发工程师 软件开发流程 软件开发工程师

主题: WindowsWordSQLLinuxMySQL
分页:12
转载请注明
本文标题:10 Ways WP-CLI Can Speed Up WordPress Development
本站链接:http://www.codesec.net/view/522376.html
分享请点击:


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 开发(php) | 评论(0) | 阅读(58)