WPSEO_Meta_Columns::get_current_post_type()publicYoast 1.0

Retrieves the post type from the $_GET variable.

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

Хуков нет.

Возвращает

Строку|null. The sanitized current post type or null when the variable is not set in $_GET.

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

$WPSEO_Meta_Columns = new WPSEO_Meta_Columns();
$WPSEO_Meta_Columns->get_current_post_type();

Код WPSEO_Meta_Columns::get_current_post_type() Yoast 22.4

public 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.
		return sanitize_text_field( wp_unslash( $_GET['post_type'] ) );
	}
	return null;
}