Table of Contents
InMotion Hosting’s WordPress Hosting includes WP-CLI. This intuitive tool allows you to maintain your WordPress websites’ content directly from the command line, as an alternative to using the Administrative Dashboard. In this guide, you will learn how to display the content of a Page, from the Command Line, using the wp post get command, in WP-CLI.
View Page Content
First you will need to find the ID of the Page. You can use the ID to identify and manipulate each Page in WP-CLI. Once you find the Page ID, you can use the wp post get subcommand to find the content of a particular Page. To view the content of a page, simply follow the steps below.
-
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 get ## –field=post_content
NOTE: Be sure to replace ## with the actual ID of the Page you are working with.
The output will be similar to the example below:
Now that you are familiar with a Page ID, you can use that ID to view the Page content.
Learn more about WP-CLI, the command-line interface for WordPress, and how to streamline your WordPress maintenance workflows!