WPSEO_Utils::get_post_type
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() WPSEO Utils::get post type Yoast 27.6
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 '';
}