WPSEO_Admin_Editor_Specific_Replace_Vars::determine_for_post()publicYoast 1.0

Determines the page type of the current post.

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

Хуков нет.

Возвращает

Строку. The page type.

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

$WPSEO_Admin_Editor_Specific_Replace_Vars = new WPSEO_Admin_Editor_Specific_Replace_Vars();
$WPSEO_Admin_Editor_Specific_Replace_Vars->determine_for_post( $post );
$post(WP_Post) (обязательный)
A WordPress post instance.

Код WPSEO_Admin_Editor_Specific_Replace_Vars::determine_for_post() Yoast 24.0

public function determine_for_post( $post ) {
	if ( $post instanceof WP_Post === false ) {
		return 'post';
	}

	$replacement_variables = $this->get();
	if ( array_key_exists( $post->post_type, $replacement_variables ) ) {
		return $post->post_type;
	}

	return 'custom_post_type';
}