jquery not calling php function

For logged in users, use: wp_ajax_{$action} For logged out users, use: wp_ajax_nopriv_{$action} Your code is currently using wp_ajax_{$action} -> wp_ajax_nizam_handler which will restrict the request to logged in (authenticated users). If you are logged out at the time of the request, you will never make it into your callback. If you want to target logged … Read more

WP_Query inside foreach loop returning same value for all options when filtered using ajax

If anyone is interested in how to achieve the result for the question I posted, I managed to work it out! As the correct results we’re being displayed, but for each iteration of the foreach loop rather than the specific day, I managed to get the results to display/hide by using if (is_object_in_term($class->ID, ‘calendar-day’, ‘monday’) … Read more

rest_no_route custom route

The problem is, you are calling a static method from inside of a non-static method. The following will work. class theme_Rest_Routes extends WP_REST_Controller{ public static function init() { $instance = new self(); add_action( ‘rest_api_init’, array( $instance, ‘register_routes’ ) ); } public function register_routes() { register_rest_route( ‘theme/v1’, ‘/menu/’, array( ‘methods’ => ‘GET’, ‘callback’ => array( $this, … Read more