Yoast\WP\SEO\Dashboard\Infrastructure\Indexables

Top_Page_Indexable_Collector::get_top_page_indexable()protectedYoast 1.0

Gets indexable for a top page URL.

Метод класса: Top_Page_Indexable_Collector{}

Хуков нет.

Возвращает

true|false|Indexable. The indexable of the top page URL or false if there is none.

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_top_page_indexable( $url );
$url(строка) (обязательный)
The URL of the top page.

Код Top_Page_Indexable_Collector::get_top_page_indexable() Yoast 25.1

protected function get_top_page_indexable( string $url ) {
	// First check if the URL is the static homepage.
	if ( \trailingslashit( $url ) === \trailingslashit( \get_home_url() ) && \get_option( 'show_on_front' ) === 'page' ) {
		return $this->indexable_repository->find_by_id_and_type( \get_option( 'page_on_front' ), 'post', false );
	}

	return $this->indexable_repository->find_by_permalink( $url );
}