• Hi,
    I’ve installed Relevanssi to help with my site search. I use Events Manager and it searches events fine but is bringing up past events too. Any idea how i can adjust the site search so it only shows events with a “future” scope?

    Thanks,
    Jen

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Mikko Saari

    (@msaari)

    Yes: create a relevanssi_do_not_index filter function that removes the past events from the index.

    add_filter( 'relevanssi_do_not_index', 'rlv_remove_past_events', 10, 2 );
    function rlv_remove_past_events( $block, $post_id ) {
        $post_type = relevanssi_get_post_type( $post_id );
        if ( 'event' === $post_type ) {
            // get event date somehow, and if it's already past:
            $block = true;
        }
        return $block;
    }

    I don’t know where Events Manager stores the event date, so I can’t tell you how exactly that is done, but that’s the main idea. Then just rebuild the index, and the past events are gone from the search.

    Thread Starter Jennyfer37

    (@jennyfer37)

    Hi,

    Thanks for your reply – really appreciate it. I’m not sure what kind of code might be required or what to look for – a real php novice. Can you give me any hints at all?

    Thanks
    Jen

    Plugin Author Mikko Saari

    (@msaari)

    Unfortunately not, because I don’t know how Events Manager works. You should probably ask the Events Manager support, they should know.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Hide past events from search’ is closed to new replies.