I’m trying to build a search function into my clients website, so people can search through expired events. The idea is, once an event has passed, it becomes an archive and a place to put photos and a write up of events that have taken place.
I’m trying to get the search to work through WordPress’s core search function.
I can get it to search through current events, but none of the past events show.
I’m basically using it by querying this URL
/?s=SEARCH+TERM&post_type=espresso_events
You can remove the filter that removes expired events when you run search queries by adding a bit of code. e.g.
function my_expired_event_search_filter( $WP_Query ) {
//do not do this in the admin queries
if ( is_admin() ) {
return;
}
if ( $WP_Query instanceof WP_Query && $WP_Query->is_search ) {
remove_all_filters( 'posts_where' );
}
}
add_action( 'pre_get_posts', 'my_expired_event_search_filter' );
Viewing 1 reply thread
The support post ‘Searching through expired events’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.
Support forum for Event Espresso 3 and Event Espresso 4.