Events Manager
[resolved] Taxonomy filter breaks pagination (4 posts)

  1. icanhazcookies
    Posted 2 years ago #

    I'm trying to filter the event listing by using a custom taxonomy as described in a couple of other topics, here's my code:

    function filter_events_location($events, $args){
        global $current_location;
    	foreach($events as $event_key => $EM_Event){
    		if(!is_object_in_term($EM_Event->post_id, 'site-location', $current_location))
    	return $events;

    However, this causes the pagination to break in event listings: the plugin creates as many pages as there would have been if the filter was not in place, and on top of that, some pages are blank, since the filter seems to be applying too late ( the plugin counted the unfiltered events for those pages and since the events were removed too late, they are not displayed, but they were still included in the loop ).

    I hope what I've said is clear enough, if not, I guess I could replicate the problem on a development server in order to show you what I mean.


  2. icanhazcookies
    Posted 2 years ago #

    I just finished testing the exact code from this older thread and the problem is in there as well.

  3. agelonwl
    Posted 2 years ago #


    have you tried this tutorial? - http://wp-events-plugin.com/tutorials/creating-custom-event-search-attributes/ (there 2 step)

  4. icanhazcookies
    Posted 2 years ago #

    Yes, if you take a look at the code I posted you can see that is exactly how it is implemented at the moment. I think I'm going to have to hook into em_events_build_sql_conditions in order for it to work properly, however that's going to be a pretty tricky.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Events Manager
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.