WPSEO_Meta_Columns::is_indexable()protectedYoast 1.0

Determines whether a particular post_id is of an indexable post type.

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

Хуков нет.

Возвращает

true|false. Whether or not it is indexable.

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

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

Код WPSEO_Meta_Columns::is_indexable() Yoast 22.4

protected function is_indexable( $post_id ) {
	if ( ! empty( $post_id ) && ! $this->uses_default_indexing( $post_id ) ) {
		return WPSEO_Meta::get_value( 'meta-robots-noindex', $post_id ) === '2';
	}

	$post = get_post( $post_id );

	if ( is_object( $post ) ) {
		// If the option is false, this means we want to index it.
		return WPSEO_Options::get( 'noindex-' . $post->post_type, false ) === false;
	}

	return true;
}