Support

Account

Home Forums Front-end Issues Include meta added via relational post object in an existing query function Reply To: Include meta added via relational post object in an existing query function

  • Sorry I have not been replying, it has gotten a little busy this week.

    The main issue is that I’m not familiar enough with the events plugin, I just don’t use it as I generally build custom events sections on the site. The events plugin is usually 1 of 2 things. Either it is overkill for what my clients need or some feature is not done the way my clients want it done.

    Anyway, looking back over the query outputs you supplied it also appears that there is not organizer meta query being done by the plugin at all. What this means is that the meta query that you’re trying to replace is not there, does not get replaced and so your changes are not applied. It appears that there have been quite a few changes in that plugin since this code was first put in place.

    Potentially this could be a priority issue and your filter is being run before the other plugin is applying the meta query

    You could try increasing the priority of your function to see if you can get a query output that actually shows the meta query being done.

    
    add_action('tribe_events_pre_get_posts', function($query) {
      echo '<pre>'; print_r($query); die;
    }, 20);