Yoast\WP\SEO\Helpers
Indexable_To_Postmeta_Helper::robots_adv_map
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{}
Хуков нет.
Возвращает
void. Ничего (null).
Использование
$Indexable_To_Postmeta_Helper = new Indexable_To_Postmeta_Helper(); $Indexable_To_Postmeta_Helper->robots_adv_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::robots_adv_map() Indexable To Postmeta Helper::robots adv map Yoast 28.7
public function robots_adv_map( $indexable, $post_meta_key ) {
$adv_settings_to_be_imported = [];
$no_adv_settings = true;
if ( $indexable->is_robots_noimageindex === true ) {
$adv_settings_to_be_imported[] = 'noimageindex';
$no_adv_settings = false;
}
if ( $indexable->is_robots_noarchive === true ) {
$adv_settings_to_be_imported[] = 'noarchive';
$no_adv_settings = false;
}
if ( $indexable->is_robots_nosnippet === true ) {
$adv_settings_to_be_imported[] = 'nosnippet';
$no_adv_settings = false;
}
if ( $no_adv_settings === true ) {
$this->meta->delete( $post_meta_key, $indexable->object_id );
return;
}
$this->meta->set_value( $post_meta_key, \implode( ',', $adv_settings_to_be_imported ), $indexable->object_id );
}