Yoast\WP\SEO\Helpers

Crawl_Cleanup_Helper::page_not_found_url()publicYoast 1.0

Returns the proper URL for 404 page.

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

Хуков нет.

Возвращает

Строку. The proper URL.

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

$Crawl_Cleanup_Helper = new Crawl_Cleanup_Helper();
$Crawl_Cleanup_Helper->page_not_found_url( $current_url );
$current_url(строка) (обязательный)
The current URL.

Код Crawl_Cleanup_Helper::page_not_found_url() Yoast 24.4

public function page_not_found_url( $current_url ) {
	if ( ! \is_multisite() || \is_subdomain_install() || ! \is_main_site() ) {
		return '';
	}

	if ( $current_url !== \home_url() . '/blog/' && $current_url !== \home_url() . '/blog' ) {
		return '';
	}

	if ( $this->current_page_helper->is_home_static_page() ) {
		return \get_permalink( \get_option( 'page_for_posts' ) );
	}

	return \home_url();
}