Home › Forums › Ticket Products › Event Tickets Plus › Hide tickets from search
- This topic has 7 replies, 3 voices, and was last updated 8 years, 11 months ago by Geoff.
-
AuthorPosts
-
May 5, 2015 at 6:03 am #960453DavideParticipant
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.
May 5, 2015 at 8:01 am #960534GeoffMemberHi 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!
GeoffMay 5, 2015 at 9:38 am #960583JakeParticipantIf 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’,
),
)`
May 5, 2015 at 9:38 am #960584JakeParticipant…That code formatting didn’t work. Let me try again:
'meta_query' => array( array( 'key' => '_tribe_wooticket_for_event', 'compare' => 'NOT EXISTS', ), )
May 5, 2015 at 2:23 pm #960662GeoffMemberThanks 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!
GeoffMay 6, 2015 at 5:33 am #960752DavideParticipantWhere should I put the code that wrote jake?
May 6, 2015 at 7:07 am #960781GeoffMemberThat would go in the query of your search results template.
May 20, 2015 at 8:33 am #963900GeoffMemberHey 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 -
AuthorPosts
- The topic ‘Hide tickets from search’ is closed to new replies.