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/wpNOTE: 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_contentNOTE: Be sure to replace ## with the actual ID of the Page you are working with.
The output will be similar to the example below:
[email protected] [~/public_html/wp]# wp post get 42 --field=post_content <div class="boldgrid-section"> <div class="container"> <div class="row gridblock"> <div class="col-md-6 col-xs-12 col-sm-12"> <h2 class="">The Write Stuff</h2> <h4 class="">A Better Copywriting Service</h4> <div class="row gridblock"> <div class="col-md-12 col-xs-12 col-sm-12"> <hr></div> </div> </div> <div class="col-md-6 col-sm-12 col-xs-12"> </div> </div> </div> </div> <div class="boldgrid-section"> <div class="container"> <div class="row gridblock"> <div class="col-md-6 col-margin-bottom col-xs-12 col-sm-12"> The concept for my company was a team effort. After chatting with local copywriters at a marketing expo, founder Janet Riley wanted to create a business where marketers and copywriters could work together to create a message that clients could genuinely get behind while driving sales for that client. Tired of the continuous process of finding clients, wooing them into hiring her for projects and then having to start over again once the project was complete, she dreamed of a better way.
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 streamline your WordPress maintenance workflow!