Hi Danniee, I use the plugin “Simply Exclude” to exclude specific item types from searches. I’m not doing this with events, but from looking through the options, this should be possible. With posts and pages, you can exclude individual posts/pages, but with the events, I believe the only options are “all” or “nothing”. Hope this helps?
Hi rkyburz, this is VERY helpful indeed! Will look into that option right away. Thank you.
Hm, it seems a bit too complicated for what I want to do. I would much more prefer if the author of the plugin could include an option to exclude events from showing up in the search results.
-
This reply was modified 7 years, 5 months ago by
danniee.
Hi danniee, sorry for this being non-ideal. I use the “simply exclude” plugin exclusively to exclude specific *pages* from the search — and for this it seems ideal. I do concede, though, that the mechanism to exclude a category such as events, looks convoluted (from a quick look at the GUI—I haven’t tried that, really). Some of this may caused by the fact that (if I remember this correctly) events just migrated from pure database content to a special post type, and from messages in this forum I also seem to remember that this migration isn’t complete yet. I suspect that if events really were regular “posts”, then excluding them using using “simply exclude” would be almost trivial.
Thank you rkyburz for your kind help. I also was a bit worried about the particular plugin being a bit outdated. I will see if I can find some other solution. Have a nice weekend!
Google “wordpress exclude custom post types from search”. Implement one of the solutions you find.
The name of the custom post type for this plug-in is ‘el_events’ (without the quotes).
I agree by the way that the plug-in should offer this as an option.
I used this code in my functions.php child theme, it works great:
// functions.php
add_action( ‘init’, ‘update_my_custom_type’, 99 );
/**
* update_my_custom_type
*
* @author Joe Sexton <[email protected]>
*/
function update_my_custom_type() {
global $wp_post_types;
if ( post_type_exists( ‘el_events’ ) ) {
// exclude from search results
$wp_post_types[‘el_events’]->exclude_from_search = true;
}}