WC_AJAX::set_wc_ajax_argument_in_query
Set the 'wc-ajax' argument in $wp_query.
Method of the class: WC_AJAX{}
No Hooks.
Returns
null. Nothing (null).
Usage
$result = WC_AJAX::set_wc_ajax_argument_in_query();
WC_AJAX::set_wc_ajax_argument_in_query() WC AJAX::set wc ajax argument in query code WC 10.8.1
private static function set_wc_ajax_argument_in_query() {
global $wp_query;
// phpcs:disable WordPress.Security.NonceVerification.Recommended
if ( ! empty( $_GET['wc-ajax'] ) && empty( $wp_query->get( 'wc-ajax' ) ) ) {
$wp_query->set( 'wc-ajax', sanitize_text_field( wp_unslash( $_GET['wc-ajax'] ) ) );
}
// phpcs:enable WordPress.Security.NonceVerification.Recommended
}