How to Create and Delete a WordPress Page Using WP-CLI Updated on March 11, 2024 by InMotion Hosting Contributor 1 Minutes, 23 Seconds to Read In This Tutorial: Create a Page Delete a Page WP-CLI is a tool available with any of InMotion Hosting’s WordPress Hosting plans. This ingenious suite of tools allows you to work on your WordPress websites from the command line. In this guide, you will learn how to create and delete a WordPress Page from the command line using the WP-CLI command, wp post. Add a Page SSH into your server as the cPanel user that owns the website you would like to work with. Use the cd command to switch to the document root directory of your website. Example: cd public_html/wp NOTE: Be sure to replace public_html/wp with the actual path to the document root directory of your website. Run the following command: wp post create –post_type=page The output will be similar to the example below: [email protected] [~/public_html/wp]# wp post create --post_type=page Success: Created post 157. Delete a Page SSH into your server as the cPanel user that owns the website you would like to work with. Use the cd command to switch to the document root directory of your website. Example: cd public_html/wp NOTE: Be sure to replace public_html/wp with the actual path to the document root directory of your website. Run the following command: wp post delete 156 NOTE: Be sure to replace 156 with the actual ID of the Page you would like to delete. The output will be similar to the example below: [email protected] [~/public_html/wp]# wp post delete 156 Success: Trashed post 156. Congratulations! Now, you know how to create and delete WordPress Pages, using WP-CLI. Learn more about WP-CLI, the command-line interface for WordPress, and how to streamline your WordPress maintenance workflows! Share this Article InMotion Hosting Contributor Content Writer InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals! More Articles by InMotion Hosting Related Articles Install and Configure WP-CLI How to Create and Delete a WordPress Page Using WP-CLI Install a Theme Using WP-CLI Install WordPress Using WP-CLI Manage WordPress Comments Using WP-CLI Update WordPress Using WP-CLI Manage WordPress Users Using WP-CLI WP-CLI search-replace Command Delete WordPress Transients Using WP-CLI Manage WordPress Plugins with WP-CLI