Wp post get (WP-CLI)
Versie door Jeroen Strompf (overleg | bijdragen) op 7 sep 2022 om 19:01
wp post get: Retrieve details about a post.
NAME wp post get DESCRIPTION Gets details about a post. SYNOPSIS wp post get <id> [--field=<field>] [--fields=<fields>] [--format=<format>] OPTIONS <id> The ID of the post to get. [--field=<field>] Instead of returning the whole post, returns the value of a single field. [--fields=<fields>] Limit the output to specific fields. Defaults to all fields. [--format=<format>] Render output in a particular format. --- default: table options: - table - csv - json - yaml --- EXAMPLES # Save the post content to a file $ wp post get 123 --field=content > file.txt
Simple example
$ wp post get 51110 +-----------------------+---------------------------------------------+ | Field | Value | +-----------------------+---------------------------------------------+ | ID | 51110 | | post_author | 4 | | post_date | 2020-05-05 18:13:15 | | post_date_gmt | 2020-05-05 18:13:15 | | post_content | | | post_title | Widgets for ABC - Kies je Toepassing | | post_excerpt | | | post_status | publish | | comment_status | closed | | ping_status | closed | | post_password | | | post_name | widgets-voor-abc-kies-je-apparaat | | to_ping | | | pinged | | | post_modified | 2021-03-12 13:17:54 | | post_modified_gmt | 2021-03-12 12:17:54 | | post_content_filtered | | | post_parent | 0 | | guid | http://en.s1/?page_id=51110 | | menu_order | 0 | | post_type | page | | post_mime_type | | | comment_count | 0 | | nl | null | +-----------------------+---------------------------------------------+