Yoast\WP\SEO\Repositories
Indexable_Repository::find_for_post_type_archive()
Retrieves an indexable for a post type archive.
Метод класса: Indexable_Repository{}
Хуков нет.
Возвращает
true|false|Indexable
. The indexable, false if none could be found.
Использование
$Indexable_Repository = new Indexable_Repository(); $Indexable_Repository->find_for_post_type_archive( $post_type, $auto_create );
- $post_type(строка) (обязательный)
- The post type.
- $auto_create(true|false)
- Create the indexable if it does not exist.
По умолчанию: true
Код Indexable_Repository::find_for_post_type_archive() Indexable Repository::find for post type archive Yoast 23.6
public function find_for_post_type_archive( $post_type, $auto_create = true ) { /** * Indexable instance. * * @var Indexable $indexable */ $indexable = $this->query() ->where( 'object_type', 'post-type-archive' ) ->where( 'object_sub_type', $post_type ) ->find_one(); if ( $auto_create && ! $indexable ) { $indexable = $this->builder->build_for_post_type_archive( $post_type ); } return $this->upgrade_indexable( $indexable ); }