exclude Events URL from search results

Home Forums Calendar Products Events Calendar PRO exclude Events URL from search results

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1584976
    Joseph Rivera
    Participant

    Hello. We are using beaver themer to build our own custom events archive page. How can we exclude the automatically generated events URL from search results. Thank you.

    #1586254
    Andras
    Keymaster

    Hi Joseph,

    Thanks for reaching out!

    I think the following snippet can give you a good starting point on that:

    [code language=”php”]
    function exclude_from_search($query) {
    if ($query->is_search) {
    $query->set(‘post_type’, array( ‘post’, ‘page’ ) );
    }
    return $query;
    }
    add_filter(‘pre_get_posts’,’exclude_from_search’);
    [/code]

    If you have other post types you want to include in your search, you will need to add those to the snippet.

    Let me know if this helps.

    Cheers,
    Andras

    #1595169
    Joseph Rivera
    Participant

    Thank you AndrĂ¡s.

    I think I need to better explain. When I said “search results” I meant how can we exclude that page from Google’s search engine results page (SERP).

    When I search “freestyle connection” on google there is a “Events Archive” link that leads to our Events URL slug. The problem though is that I’m not using that page for events archive. Instead I’ve created a archive page using Beaver Themer.

    How can I remove the Events URL Slug being generated by Events Calendar? I hope this is more clear. Thank you again.

    #1596845
    Barry
    Member

    Hi Joseph,

    Thanks for clarifying. Would the following strategy work for you?

    • Review and remove any remaining links to the main event archive page
    • Use a suitable plugin to implement 301 redirects from the default event archive to your custom page

    There are various plugins that might help with that second point.

    I hope that helps!

    #1614243
    Support Droid
    Keymaster

    Hey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.

    Thanks so much!
    The Events Calendar Support Team

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘exclude Events URL from search results’ is closed to new replies.