Yoast\WP\SEO\Builders
Indexable_Term_Builder::find_alternative_image()
Finds an alternative image for the social image.
Метод класса: Indexable_Term_Builder{}
Хуков нет.
Возвращает
Массив|true|false
. False when not found, array with data when found.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->find_alternative_image( $indexable );
- $indexable(Indexable) (обязательный)
- The indexable.
Код Indexable_Term_Builder::find_alternative_image() Indexable Term Builder::find alternative image Yoast 24.1
protected function find_alternative_image( Indexable $indexable ) { $content_image = $this->image->get_term_content_image( $indexable->object_id ); if ( $content_image ) { return [ 'image' => $content_image, 'source' => 'first-content-image', ]; } return false; }