Yoast\WP\SEO\Routes

Yoast_Head_REST_Field::for_post_type_archive()publicYoast 1.0

Returns the head for a post type archive.

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

Хуков нет.

Возвращает

Строку|null. The head.

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

$Yoast_Head_REST_Field = new Yoast_Head_REST_Field();
$Yoast_Head_REST_Field->for_post_type_archive( $params, $format );
$params(массив) (обязательный)
The rest request params.
$format(строка)
The desired output format.
По умолчанию: self::YOAST_HEAD_ATTRIBUTE_NAME

Код Yoast_Head_REST_Field::for_post_type_archive() Yoast 23.6

public function for_post_type_archive( $params, $format = self::YOAST_HEAD_ATTRIBUTE_NAME ) {
	if ( $params['slug'] === 'post' ) {
		$obj = $this->head_action->for_posts_page();
	}
	elseif ( ! $this->post_type_helper->has_archive( $params['slug'] ) ) {
		return null;
	}
	else {
		$obj = $this->head_action->for_post_type_archive( $params['slug'] );
	}

	return $this->render_object( $obj, $format );
}