Yoast\WP\SEO\Builders
Indexable_Link_Builder::update_first_content_image()
Updates the image ids when the indexable images are marked as first content image.
Метод класса: Indexable_Link_Builder{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
$Indexable_Link_Builder = new Indexable_Link_Builder(); $Indexable_Link_Builder->update_first_content_image( $indexable, $images ): void;
- $indexable(Indexable) (обязательный)
- The indexable to change.
- $images(array<string|int>) (обязательный)
- The image array.
Код Indexable_Link_Builder::update_first_content_image() Indexable Link Builder::update first content image Yoast 24.0
public function update_first_content_image( Indexable $indexable, array $images ): void { $current_open_graph_image = $indexable->open_graph_image; $current_twitter_image = $indexable->twitter_image; $first_content_image_url = \key( $images ); $first_content_image_id = \current( $images ); if ( $indexable->open_graph_image_source === 'first-content-image' && $current_open_graph_image === $first_content_image_url && ! empty( $first_content_image_id ) ) { $indexable->open_graph_image_id = $first_content_image_id; } if ( $indexable->twitter_image_source === 'first-content-image' && $current_twitter_image === $first_content_image_url && ! empty( $first_content_image_id ) ) { $indexable->twitter_image_id = $first_content_image_id; } }