• Hi,

    Im having a problem where the exact same query retrieves different results depending on wether the query is run via PHP directly or via ajax.

    The following screenshot shows the inspection of variables at run time (ran via PHP directly left and via ajax right:

    https://cl.ly/0H0v283H3p1a

    The query for both cases is:

           $args = array(
               'post_type' => 'event',
               'suppress_filters' => false,
               'event_start_after'=> 'today',
               'event_end_after'=> $start,
               'event_start_before'=> $end,
               'group_events_by'=> 'series',
               'orderby'       => 'eventstart',
               'order'       => 'DESC'
           );
    
           $events = get_posts($args);

    The $start and $end variables are passed through and have the values last Monday and this Sunday respectively.

    Any idea why the exact same query would output different results? The direct query returns the events in ASC order of starting date (expected behaviour) but the ajax query results the results in a incorrect order.

    Thank you.

    • This topic was modified 7 years, 10 months ago by Luis Martins.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Queries via AJAX don’t keep the same order with exact same parameters’ is closed to new replies.