WPSEO_Abstract_Post_Filter::get_current_post_type
Returns the current post type.
Метод класса: WPSEO_Abstract_Post_Filter{}
Хуков нет.
Возвращает
Строку. The current post type.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->get_current_post_type();
Код WPSEO_Abstract_Post_Filter::get_current_post_type() WPSEO Abstract Post Filter::get current post type Yoast 26.5
protected function get_current_post_type() {
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.
if ( isset( $_GET['post_type'] ) && is_string( $_GET['post_type'] ) ) {
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.
$post_type = sanitize_text_field( wp_unslash( $_GET['post_type'] ) );
if ( ! empty( $post_type ) ) {
return $post_type;
}
}
return 'post';
}