Yoast\WP\SEO\Helpers
Indexable_To_Postmeta_Helper::social_image_map
Map social image data only if social image is explicitly set.
Метод класса: Indexable_To_Postmeta_Helper{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$Indexable_To_Postmeta_Helper = new Indexable_To_Postmeta_Helper(); $Indexable_To_Postmeta_Helper->social_image_map( $indexable, $post_meta_key, $indexable_column );
- $indexable(Indexable) (обязательный)
- The Yoast indexable.
- $post_meta_key(строка) (обязательный)
- The post_meta key that will be populated.
- $indexable_column(строка) (обязательный)
- The indexable data that will be mapped to post_meta.
Код Indexable_To_Postmeta_Helper::social_image_map() Indexable To Postmeta Helper::social image map Yoast 26.9
public function social_image_map( $indexable, $post_meta_key, $indexable_column ) {
if ( empty( $indexable->{$indexable_column} ) ) {
return;
}
switch ( $indexable_column ) {
case 'open_graph_image':
case 'open_graph_image_id':
$source = $indexable->open_graph_image_source;
break;
case 'twitter_image':
case 'twitter_image_id':
$source = $indexable->twitter_image_source;
break;
}
// Map the social image data only when the social image is explicitly set.
if ( $source === 'set-by-user' || $source === 'imported' ) {
$value = (string) $indexable->{$indexable_column};
$this->meta->set_value( $post_meta_key, $value, $indexable->object_id );
}
}