WP_Query extended with AJAX

Im using the wp_query with ajax to display and filter my custom post.

everything works fine until i try to use my extended version of wp_query in the args parameters.

my js file code:

    var filter = $('#filter');
        data:filter.serialize(), // form data
        type:filter.attr('method'), // POST
            filter.find('button').text('Processing...'); // changing the button label
            filter.find('button').text('Apply filter'); // changing the button label back
            $('#response').html(data); // insert data
    return false;

the php part with args:

    $args = array(
    'post_type' => 'rides',
     'geo_query' => array( 
            'latfrom'      => '45.7579341',
            'lngfrom'      => '4.7650812', 
            'latto'      => '26.123555',
            'lngto'      => '6.5445445', 
            'distancefrom' => 10,
            'distanceto' => 10,
            'compare'  => '<='

As you can see, I am using the custom geo_query parameter, which is an extension of the wp_query. This does work when using the standard wp_query BUT NOT when using it with ajax…

What am I doing wrong here ?

Read more here: WP_Query extended with AJAX

Leave a Reply

Your email address will not be published. Required fields are marked *