WP_CLI\Fetchers

Post::get()publicWP-CLI 1.0

Get a post object by ID

Method of the class: Post{}

No Hooks.

Return

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() code WP-CLI 2.8.0-alpha

public function get( $arg ) {
	$post = get_post( $arg );

	if ( null === $post ) {
		return false;
	}

	return $post;
}