Yoast\WP\SEO\Actions\Indexables

Indexable_Head_Action::for_404()publicYoast 1.0

Retrieves the head for the 404 page. Always sets the status to 404.

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

Хуков нет.

Возвращает

Объект. Object with head and status properties.

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

$Indexable_Head_Action = new Indexable_Head_Action();
$Indexable_Head_Action->for_404();

Код Indexable_Head_Action::for_404() Yoast 22.3

public function for_404() {
	$meta = $this->with_cache( '404' );

	if ( ! $meta ) {
		return (object) [
			'html'   => '',
			'json'   => [],
			'status' => 404,
		];
	}

	$head = $meta->get_head();

	return (object) [
		'html'   => $head->html,
		'json'   => $head->json,
		'status' => 404,
	];
}