Support » Plugin: Event Organiser » Queries via AJAX don’t keep the same order with exact same parameters

  • Luis Martins

    (@lmartins)


    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.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Stephen Harris

    (@stephenharris)

    Event Organiser wouldn’t treat the two queries differently – it’s probable that there is some other plug-in here that is affecting the query in some contexts. Your best bet is to inspect the two raw SQL queries and compare them. That will show you what is different, and may help you identify why.

    Luis Martins

    (@lmartins)

    Thanks for the tip Stephen. This was in fact a conflict with https://wordpress.org/plugins/intuitive-custom-post-order/

    Thank you.

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.