WP_CLI\Fetchers
Post::get
Get a post object by ID
Method of the class: Post{}
No Hooks.
Returns
WP_Post|Array|false. The item if found; false otherwise.
Usage
$Post = new Post(); $Post->get( $arg );
- $arg(string) (required)
- The raw CLI argument.
Post::get() Post::get code WP-CLI 2.13.0-alpha
public function get( $arg ) {
$post = get_post( $arg );
if ( null === $post ) {
return false;
}
return $post;
}