WPSEO_Utils::get_post_type()public staticYoast 1.0

Gets the type of the current post.

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

Хуков нет.

Возвращает

Строку. The post type, or an empty string.

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

$result = WPSEO_Utils::get_post_type();

Код WPSEO_Utils::get_post_type() Yoast 22.3

public static function get_post_type() {
	$wp_screen = get_current_screen();

	if ( $wp_screen !== null && ! empty( $wp_screen->post_type ) ) {
		return $wp_screen->post_type;
	}
	return '';
}