22 C
Thursday, October 1, 2020

10 Best Ways to Use WP-CLI for Managing Your WordPress Site

- Advertisement - data-full-width-responsive="false">

The WordPress site is a content management system which is preferred widely for creating a website. It is easy to use and handle with its graphical interface.

- Advertisement -

In general, all the installs, updates, backups, etc., are performed from the admin panel after login. However, it can be done quicker from the command line with the WP-CLI tool. With this, you won’t have to login to the admin panel too.

Here Is The List Of Actions You Can Do With The WP-CLI:

1. Install WordPress Site

Installing a WordPress is now easy with the WP-CLI core install command. You will have to open the command prompt and input a simple command with the required parameters; URL, site title, admin username, admin password, admin email.

The command you have to add is, wp core install –url=” site name” –title=”Site Title” –admin_user=”login username” –admin_password=” login password” –admin_email=” admin email address” Once it finishes configuring, it will display a message “Success: WordPress installed successfully”


2. Update WordPress

Keeping WordPress site up-to-date is important to increase the performance of your site. With every latest update, WordPress becomes more secure and come with patches for scripts.

To do it via WP-CLI command is easier than you think. For updating your site to the latest version you will have to input the command “wp core update” and you will receive a success message once completed.

Similarly, updating to a particular version can be done by giving the command as wp core update —version= “version number” and to go back the previous version, use the command wp core update —version= “version number” —force.


3. Install Themes

Creating a theme will be the priority for any website owner. Instead of doing it via control panel, you can also do it in the command line interface too.

For this, first, you will have to check the list of themes installed in your site. By typing wp theme list in the command prompt, you will get the accurate list of themes which you are using currently.


Now, if you wish to change the theme and looking for the available options, type wp theme search followed by the keyword for the theme. e.g.: fancy, bright, etc. This will display the relevant themes along with their ratings.

Choose one and install it easily by typing wp theme install “name of the theme” and it will be successful.


4. Update Themes

Irrespective of the theme installed, it is necessary to update it on a regular basis to obtain the benefits of the theme with every latest update.

Updating a theme takes a lot of time when done via Cpanel, the shortest and the quickest method of doing it is to open the command prompt and input wp theme status to check the list of themes that requires an update.

Now give a command, wp theme update — all and it will update the theme to the latest version.


5. Install Plugins

Plugins help in creating an interactive interface to your site. Just like the themes, the plugins can also be installed with ease from the command line.

To look at the list of plugins available input wp plugin list and look if they are active. If you are aware of the name of the plugin, input, wp plugin search “plugin keyword” and look for the slug name of the desired plugin.

Now, input wp plugin install “plugin’s slug” and activate it by giving a command wp plugin activate “plugin slug”


6. Update Plugins

Similar to the themes, updating a plugin requires checking the current status of the plugin. In order to make it have a strong security link input wp plugin update –all and keep all your plugins up-to-date.

In the off chance if you wish to simply update a single plugin, type wp plugin update “plugin name” and get your job done.


7. Manage Content

Managing content on a WordPress platform literally means editing or updating the post details.

Instead of performing it the usual way, you can do it in the command line interface itself. In general, as soon as you open a WordPress account, you will get a default post titled, “hello world”.

To edit this post you will have to first search it from the page by typing wp post list. Following this step, you can edit it by giving a command wp post edit 1 and manage the content by adding a content of your choice.

The post title can be edited by typing wp post update 1 –post_title “content of your choice” Clicking save, will make changes to this file.


8. Manage Database

Interacting with the WordPress SQL can also be done right from the command line prompt. Simply type wp db cli and get into the MYSQL prompt.

From this, you can perform database admin operations. Also, to exit from the database interface simply type exit in the command.

Coming to querying the database, give a command, wp db query “SELECT user_login,ID FROM wp_users;” Same way, if your database requires optimizing, it can be done by giving a command, wp dp optimize.


9. Create A Sample Post

Creating posts in the WordPress blogs is really time-consuming. But, once you get comfortable to use this WP-CLI command, you will start creating the entire posts for the blog from the command line interface itself. If you wish to try creating a sample post, open the command line interface and type the following:

wp post create –post_type=page –post_status=publish –post_title= ‘My sample post’ –post_content= ‘This is a sample post ‘Success: Created post 5.

This will create a post titled my sample post in your page. In the same way, you can do it for all the original posts.


10. Delete A Post

If you consider removing a post from your page due to any reason, try doing it from the command line interface this time.

The only thing you should be careful is to know the post number you wish to delete and mention it correctly in the command prompt. Else, you will end up deleting the wrong post.

So, to delete a particular post, just type, wp post delete 4 –forceSuccess: deleted post 4. This will delete the post and move it to trash.

- Advertisement -
- Advertisement -

Trending Now

Learn Programming From Beginner to Pro Using These Android Apps

Programming has captured the hearts of many people as it gives them the ability to think, visualize something and achieve it. Many people choose...
- Advertisement -

Startimes Subscription Prices, Packages and Channels List in 2020

StarTimes Nigeria is one of the popular cable TV providers in Nigeria. This service is a subsidiary of a Chinese based company...

10 Best Places to Download Bollywood Movies

Do you spend hours watching Bollywood movies as I do? Have you been in search of the perfect sites to download the...

7 Best Offline Racing Games for Android Users in 2020

Are you a real gamer? If you are one, then you will know how exciting it can be to experience the adrenaline rush that...

9+ Infinix Phones With Best Camera in 2020

People purchase smartphones for different reasons, and it is no brainer that the camera specifications is one of the features they look out for...

GB WhatsApp, WhatsApp Plus and OG WhatsApp Tips and Tricks

Checkout the new GB WhatsApp Tutorial. Hello, welcome to WhatsApp Plus, OG WhatsApp and GB WhatsApp tips and tricks. For the sake of this article,...

22 Smartphones With the Highest Screen to Body Ratio in 2020

Screen to body ratio on a smartphone screen recently turned into an important thing to consider when comparing smartphones. It became more...

Best Low Size PC Action Games For Your Old PC/Laptop With Low Specs

Gaming time is one our favorite time and nothing beats the ability to play high-quality games on our PCs but like some of our...

5 Best Under 15,000 Naira Smartphones in Nigeria

Smartphones are currently like the way of life today, and everybody needs one of them devices. The need to stay up to...

DStv Channels List, Packages and Prices in 2020

Thousands of people in Nigeria have put their trust in DStv to provide them with the very best of television shows and programs. DStv (Digital...

How to Recover Lost Snapchat Account?

Losing a Snapchat account can be disastrous as many of us use the Social for private purposes and its privacy oriented features. Forgetting passwords...
- Advertisement -

Related Posts

Voice Search: Voice Only Search to Take Over in 2020

By the year 2020, people will no longer require the use of screens to conduct as much as 40% of their web sessions. That...

Best Phones to Expect in 2020

With the present speedy pace of smartphone evolution, there is always something new waiting in the wings. It's almost as if no sooner have...

Q-See QS408-811-5 8 Channel H.264 DVR Security Camera System

In the 21st century, security is a major concern for everyone. Crime is at an all time high and so, we need to do...

What Is Samsung Bixby?

Bixby is Samsung virtual assistant. It encompassed as a lot of things, which include voice assistant, machine learning, visual help and other useful functions....

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.