Yoast\WP\SEO\Helpers

Indexable_To_Postmeta_Helper::nofollow_map()publicYoast 1.0

Deletes the nofollow post_meta key if no nofollow in the indexable or if nofollow is false. Populates the post_meta key appropriately if there is a true nofollow in the indexable.

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

Хуков нет.

Возвращает

null. Ничего (null).

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

$Indexable_To_Postmeta_Helper = new Indexable_To_Postmeta_Helper();
$Indexable_To_Postmeta_Helper->nofollow_map( $indexable, $post_meta_key );
$indexable(Indexable) (обязательный)
The Yoast indexable.
$post_meta_key(строка) (обязательный)
The post_meta key that will be populated.

Код Indexable_To_Postmeta_Helper::nofollow_map() Yoast 22.4

public function nofollow_map( $indexable, $post_meta_key ) {
	if ( \is_null( $indexable->is_robots_nofollow ) || $indexable->is_robots_nofollow === false ) {
		$this->meta->delete( $post_meta_key, $indexable->object_id );
	}

	if ( $indexable->is_robots_nofollow === true ) {
		$this->meta->set_value( $post_meta_key, 1, $indexable->object_id );
	}
}