Home Website TutorialsWordPress Summary of WP CLI commands

Summary of WP CLI commands

by Thạch Phạm
Published: Last Updated on
A+A-
Reset

In previous posts, AZDIGI showed you how to install WP-CLI and use WP-CLI to install a WordPress website. Surely you are interested, so how can you manage your WordPress website through WP-CLI? Then in this article, AZDIGI will guide you with some basic commands so that you can manage your WordPress website.

Note: You need to access the command line to use WP-CLI, if you use ShareHosting services and run with user rights, you just need to run the commands below. As for using WP-CLI on Server/VPS and running as root, you need to add the option --allow-root after each command.

Before starting implementation, you need to make sure the following factors are met:

When you have met all the above factors, all that remains is for you to move to the right website to administer and start using WP-CLI with the command lines below.

Manage WordPress Versions

  • Download the latest WordPress version from the homepage.
wp core download
  • Check the version of WordPress you are using.
wp core version
  • Update to the latest WordPress version
wp core update
  • Downgrade or upgrade a certain version.
wp core update --version=5.3.2 --force

You replace 5.3.2 with the version of WordPress you want to change.

Database Management

  • Update database.
wp core update-db
  • Database optimization.
wp db optimize
  • Repair database.
wp db repair
  • Export database
wp db export
  • Import database
wp db import

Theme Manager

  • Search themes
wp theme search tên-theme
  • Install themes
wp theme install tên-theme
  • List of themes in use
wp theme list
  • Active the theme
wp theme active tên-theme
  • Update theme
wp theme update tên-theme
  • Update all themes
wp theme update --all
  • Uninstall theme
wp theme uninstall tên-theme
  • Delete theme
wp theme delete tên-theme

Manage Plugins

  • List all plugins installed on WordPress.
wp plugin list
  • List updated plugins.
wp plugin list --update=available
  • Display output in json or csv format.
wp plugin list --format=json
wp plugin list --format=csv
  • Install the zip plugin at wp-content/plugins
wp plugin install tên-plugin
  • Install the plugin from a URL.
wp plugin install https://example.com/ten_plugin.zip
  • Activate a plugin
wp plugin activate tên-plugin
  • Disable a plugin
wp plugin deactive tên-plugin
  • Uninstall plugin
wp plugin uninstall tên-plugin
  • Update a plugin
wp plugin update tên-plugin
  • Update all plugins
wp plugin update --all

Manage WordPress Users

  • Show users
wp user list
  • Create a new user
wp user create tên-user admin@gmail.com --role=administrator

administrator: This is the permission you want to assign to the user (you can change it to Super Admin-Editor-Author – Contributor – Subscriber depending on your purpose)

  • Change user password
wp user update tên-user --user_pass=matkhaumoi
  • Update user permissions
wp user update tên-user --role=administrator
  • Delete user
wp user delete tên-user --reassign=tên-user

You can replace the name-user with the corresponding ID of that user.

Manage WordPress Posts

  • Show posts
wp post list
  • Create post
wp post create --post_status=publish --post_title='Tên bài viết' --edit
  • Create multiple posts at the same time (10 posts)
wp post generate --count=10
  • Delete posts
wp post delete ID-bàiviết

Other functions

In addition to the basic functions AZDIGI introduced, WP-CLI has many other functions that are used similarly to the functions above. You can find out more here

In addition, if you are a professional user, and are familiar with WP-CLI, you can refer to the WP-CLI integration tool packages here: Click here for more great features.

Summary

So AZDIGI has shown you in detail how to use WP-CLI to manage your WordPress website, when you are gradually familiar with WP-CLI, WordPress administration for you becomes extremely simple and fast.

Wishing you success!

If you need assistance, you can contact support in the ways below:

Đánh giá

Tham gia nhóm hỗ trợ Server - Hosting

Tham gia nhóm Hỗ trợ Server - Hosting & WordPress để cùng nhau hỏi đáp và hỗ trợ các vấn đề về WordPress, tối ưu máy chủ/server.

Tham gia ngay

Bài viết cùng chuyên mục

AZDIGI – Không chỉ là đơn vị hàng đầu trong lĩnh vực Web Hosting và Máy chủ, chúng tôi mong muốn mang lại những kiến thức bổ ích nhất và luôn cập nhật thường xuyên cho cộng đồng người đam mê thiết kế website, công nghệ,…

Vui lòng không sao chép nội dung nếu chưa xin phép. Designed and Developed by PenciDesign