• Hello hello,

    I’ve been asked to work on an existing WordPress installation where the Event Organiser plugin is installed (and working).

    I realized that it interferes somehow with other WP_query() that are used somewhere else on the web site. And more specifically when I use tax_query

    If the plugin is disabled, the query works. If I re-activate the plugin, it stops working. If I check the dump of the SQL query, I see it add some criteria which aren’t supposed to be there, and so I get no results where I should have some.

    Here is a query for example, where no event info is related:

    $group_arg = array(
    	'posts_per_page' => 8,
    	'post_type' => 'church_group',
    	'post_status' => 'publish',
    	'tax_query' => array(
    		array (
    			'taxonomy' => 'domain_name',
    			'field' => 'slug',
    			'terms' => 'liege',
    		)
    	),
    );
    
    $group = null;
    $group = new WP_Query($group_arg);

    The SQL dump is:
    "SELECT SQL_CALC_FOUND_ROWS wp_5_posts.ID FROM wp_5_posts LEFT JOIN wp_5_term_relationships ON (wp_5_posts.ID = wp_5_term_relationships.object_id) WHERE 1=1 AND ( wp_5_term_relationships.term_taxonomy_id IN (869) ) AND wp_5_posts.post_type = 'church_group' AND ((wp_5_posts.post_status = 'publish')) AND wp_5_eo_events.StartDate >= '2020-10-20' GROUP BY wp_5_posts.ID ORDER BY wp_5_eo_events.StartDate ASC, wp_5_eo_events.StartTime ASC LIMIT 0, 8"

    As you can see here, this whole part shouldn’t be in the query as I never asked for it: AND wp_5_eo_events.StartDate >= '2020-10-20' GROUP BY wp_5_posts.ID ORDER BY wp_5_eo_events.StartDate ASC, wp_5_eo_events.StartTime ASC

    Not very sure how to fix this, so any idea would be helpful, thanks!

    • This topic was modified 5 years, 6 months ago by aolbrechts.

The topic ‘Plugin interfers with other WP_query()’ is closed to new replies.