WPSEO_Admin_Recommended_Replace_Vars::determine_for_post_type()publicYoast 1.0

Determines the page type for a post type.

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

Хуков нет.

Возвращает

Строку. The page type.

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

$WPSEO_Admin_Recommended_Replace_Vars = new WPSEO_Admin_Recommended_Replace_Vars();
$WPSEO_Admin_Recommended_Replace_Vars->determine_for_post_type( $post_type, $fallback );
$post_type(строка) (обязательный)
The name of the post_type.
$fallback(строка)
The page type to fall back to.
По умолчанию: 'custom_post_type'

Код WPSEO_Admin_Recommended_Replace_Vars::determine_for_post_type() Yoast 23.8

public function determine_for_post_type( $post_type, $fallback = 'custom_post_type' ) {
	$page_type                   = $post_type;
	$recommended_replace_vars    = $this->get_recommended_replacevars();
	$has_recommended_replacevars = $this->has_recommended_replace_vars( $recommended_replace_vars, $page_type );

	if ( ! $has_recommended_replacevars ) {
		return $fallback;
	}

	return $page_type;
}