• Resolved GreWeb

    (@fil6718)


    Hi, is it possible to make events appear in the general wordpress search. I tried to include this function in my function.php file without success. Any clue?

    function include_events_in_search($query) {
    if (!is_admin() && $query->is_main_query() && $query->is_search()) {
    $query->set('post_type', array('post', 'page', 'event'));}
    return $query;}
    add_filter('pre_get_posts', 'include_events_in_search');

Viewing 2 replies - 1 through 2 (of 2 total)
  • I think your code snippet should work. Maybe you have some other plugin that is causing it to not include event types in the search.

    • This reply was modified 1 month, 3 weeks ago by joneiseman.

    Check in Events > Settings in the Pages tab in General Setttings in the Event List/Archives section make sure the “Include in WordPress Searches?” option is set to Yes.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.