WPSEO_Taxonomy_Columns::get_current_taxonomy
Retrieves the taxonomy from the $_GET or $_POST variable.
Метод класса: WPSEO_Taxonomy_Columns{}
Хуков нет.
Возвращает
Строку|null. The current taxonomy or null when it is not set.
Использование
$WPSEO_Taxonomy_Columns = new WPSEO_Taxonomy_Columns(); $WPSEO_Taxonomy_Columns->get_current_taxonomy();
Код WPSEO_Taxonomy_Columns::get_current_taxonomy() WPSEO Taxonomy Columns::get current taxonomy Yoast 28.0
public function get_current_taxonomy() {
// phpcs:disable WordPress.Security.NonceVerification.Missing,WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.
if ( ! empty( $_SERVER['REQUEST_METHOD'] ) && $_SERVER['REQUEST_METHOD'] === 'POST' ) {
if ( isset( $_POST['taxonomy'] ) && is_string( $_POST['taxonomy'] ) ) {
return sanitize_text_field( wp_unslash( $_POST['taxonomy'] ) );
}
}
elseif ( isset( $_GET['taxonomy'] ) && is_string( $_GET['taxonomy'] ) ) {
return sanitize_text_field( wp_unslash( $_GET['taxonomy'] ) );
}
// phpcs:enable WordPress.Security.NonceVerification.Missing,WordPress.Security.NonceVerification.Recommended
return null;
}