Yoast\WP\SEO\Abilities\Infrastructure

Post_Identifier_Resolver::by_id │ private │ Yoast 1.0

Resolves a post by its ID.

Метод класса: Post_Identifier_Resolver{}

Хуков нет.

Возвращает

Indexable|WP_Error. The matching indexable, or a not-found error.

Использование

// private - только в коде основоного (родительского) класса
$result = $this->by_id( $post_id );
$post_id(int) (обязательный)
The post ID.

Код Post_Identifier_Resolver::by_id() Yoast 28.9

private function by_id( int $post_id ) {
	$indexable = $this->indexable_repository->find_by_id_and_type( $post_id, 'post', false );

	if ( ! $indexable ) {
		return $this->invalid_identifier( 'post_id' );
	}

	return $indexable;
}