WP-CLI allows you to manage your website built on WordPress from the command line. It's easy to gather important details about existing content, such as Posts / Pages. These details are needed in the command syntax to handle the various components of your website.

To find the details of your Posts / Pages using the WP-CLI, we recommend that you follow the instructions below:

 

Listing Post details

- Log in to the server via SSH with the cPanel user who owns the website you want to work on.

- Use the cd command to access the root folder of your website eg:

cd public_html/wp

Replace public_html/wp with the actual path to the root folder of your website.

 

Run the following command:

wp post list

It will return an output similar to:

[email protected] [~/public_html/wp]# wp post list +----+----------------+------------------+---------------------+-------------+ | ID | post_title     | post_name        | post_date           | post_status | +----+----------------+------------------+---------------------+-------------+ | 39 | Blogging 101   | blogging-101     | 2018-02-21 16:17:58 | publish     | | 40 | Basic...nomies | basic-taxonomies | 2018-02-21 16:17:58 | publish     | | 41 | Tips...Writing | tip...er-writing | 2018-02-21 16:17:58 | publish     | +----+----------------+------------------+---------------------+-------------+

Listing Page details

Since Pages are stored in the same way as Posts, you can use the wp post list subcommand to view details about the Pages on your website.

Here are the steps required to list the details of your website Pages, using WP-CLI:

- Log in to the server via SSH with the cPanel user who owns the website you want to work on.

- Use the cd command to access the root folder of your website eg:

cd public_html/wp

Replace public_html/wp with the actual path to the root folder of your website.

 

Run the following command:

wp post list –post_type=page

It will return an output similar to:

[email protected] [~/public_html/wp]# wp post list --post_type=page +----+-----------------+-----------------+---------------------+-------------+ | ID | post_title      | post_name       | post_date           | post_status | +----+-----------------+-----------------+---------------------+-------------+ | 42 | About Us        | about-us        | 2018-02-21 16:17:58 | publish     | | 44 | Clients         | clients         | 2018-02-21 16:17:58 | publish     | | 46 | Gallery         | gallery         | 2018-02-21 16:17:58 | publish     | | 48 | Resume          | resume          | 2018-02-21 16:17:58 | publish     | | 50 | Info            | info            | 2018-02-21 16:17:58 | publish     | | 52 | Testimonials    | testimonials    | 2018-02-21 16:17:58 | publish     | | 54 | Contact Us      | contact-us      | 2018-02-21 16:17:58 | publish     | | 37 | Home            | home            | 2018-02-21 16:17:57 | publish     | +----+-----------------+-----------------+---------------------+-------------+

 

For assistance in applying the above instructions on HostX servers please contact us. HostX offers the fastest WordPress hosting and can help you solve your problems.

Cette réponse était-elle pertinente? 0 Utilisateurs l'ont trouvée utile (0 Votes)