Yoast\WP\SEO\Repositories
Indexable_Repository::find_for_home_page()
Retrieves the homepage indexable.
Метод класса: Indexable_Repository{}
Хуков нет.
Возвращает
true|false|Indexable
. Instance of indexable.
Использование
$Indexable_Repository = new Indexable_Repository(); $Indexable_Repository->find_for_home_page( $auto_create );
- $auto_create(true|false)
- Create the indexable if it does not exist.
По умолчанию: true
Код Indexable_Repository::find_for_home_page() Indexable Repository::find for home page Yoast 22.4
public function find_for_home_page( $auto_create = true ) { $indexable = \wp_cache_get( 'home-page', 'yoast-seo-indexables' ); if ( ! $indexable ) { /** * Indexable instance. * * @var Indexable $indexable */ $indexable = $this->query()->where( 'object_type', 'home-page' )->find_one(); if ( $auto_create && ! $indexable ) { $indexable = $this->builder->build_for_home_page(); } $indexable = $this->upgrade_indexable( $indexable ); \wp_cache_set( 'home-page', $indexable, 'yoast-seo-indexables', ( 5 * \MINUTE_IN_SECONDS ) ); } return $indexable; }