Yoast\WP\SEO\Helpers

Post_Helper::is_post_indexable()publicYoast 1.0

Determines if the post can be indexed.

{} Это метод класса: Post_Helper{}

Хуков нет.

Возвращает

true|false. True if the post can be indexed.

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

$Post_Helper = new Post_Helper();
$Post_Helper->is_post_indexable( $post_id );
$post_id(int) (обязательный)
Post ID to check.

Код Post_Helper::is_post_indexable() Yoast 18.8

public function is_post_indexable( $post_id ) {
	// Don't index excluded post statuses.
	if ( \in_array( \get_post_status( $post_id ), $this->get_excluded_post_statuses(), true ) ) {
		return false;
	}

	// Don't index revisions of posts.
	if ( \wp_is_post_revision( $post_id ) ) {
		return false;
	}

	// Don't index autosaves that are not caught by the auto-draft check.
	if ( \wp_is_post_autosave( $post_id ) ) {
		return false;
	}

	return true;
}