Hide tickets from search

Home Forums Ticket Products Event Tickets Plus Hide tickets from search

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #960453
    Davide
    Participant

    Looking for something on my website (with the search bar) you will get the events and the tickets, both lead to the same page. “caccia_al_grifone_16_08” is the name of the ticket, and I want this and other tickets does not appear among the search results

    Thank you.

    #960534
    Geoff
    Member

    Hi there, Davide! Welcome to the forums. 🙂

    Good question. Tickets are registered as Products in WooCommerce, which are their own post type. It seems as though your site’s search includes WooCommerce Products in its search parameters, so you’ll want to exclude them.

    I found this thread where someone was able to do that with a snippet. I’d give that a shot as a way to exclude WooCommerce Products from being included in your search results.

    If that doesn’t work, then perhaps the Search Everything plugin will be a good option. It allows you to exclude specific post types from the WordPress search function.

    Cheers!
    Geoff

    #960583
    Jake
    Participant

    If your search page is running a WP_Query, you can drop this into it.

    `’meta_query’ => array(
    array(
    ‘key’ => ‘_tribe_wooticket_for_event’,
    ‘compare’ => ‘NOT EXISTS’,
    ),
    )`

    #960584
    Jake
    Participant

    …That code formatting didn’t work. Let me try again:

    'meta_query' => array(
    	array(
    		'key'     => '_tribe_wooticket_for_event',
    		'compare' => 'NOT EXISTS',
    	),
    )
    #960662
    Geoff
    Member

    Thanks for dropping that in, Jake! I appreciate the feedback and this looks like a solid solution.

    Davide, will Jake’s suggestion above work for you? Please let me know. 🙂

    Cheers!
    Geoff

    #960752
    Davide
    Participant

    Where should I put the code that wrote jake?

    #960781
    Geoff
    Member

    That would go in the query of your search results template.

    #963900
    Geoff
    Member

    Hey there, Davide! This thread has been pretty quiet for a couple of weeks, so I’m going to go ahead and close it. Please feel free to start a new thread if you still have questions here and we’d be happy to help. 🙂

    Cheers!
    Geoff

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Hide tickets from search’ is closed to new replies.