WPSEO_Abstract_Post_Filter::get_current_post_type()protectedYoast 1.0

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() Yoast 22.4

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';
}