Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ericakfranz/32f0571b12b972643203 to your computer and use it in GitHub Desktop.
Save ericakfranz/32f0571b12b972643203 to your computer and use it in GitHub Desktop.
Exclude Envira Galleries from search results.
add_filter( 'envira_gallery_post_type_args', 'filter_envira_search' );
function filter_envira_search( $args ) {
$args['exclude_from_search'] = true;
return $args;
}
@lepittenger
Copy link

this is great, thank you!

@porwig
Copy link

porwig commented Jan 9, 2016

Thanks for sharing this! I added that code at the end of /wp-includes/default-filters.php - it works fine but I have a question: Is adding it to default-filters.php the right place to follow WP best practices, or should this code be added somewhere else or called another way?

@damadorPL
Copy link

best way is to add -to functions.php in your child theme

@wsoyka
Copy link

wsoyka commented Oct 21, 2018

Thanks for this! No idea why they still haven't disabled this themselves after more than 3 years.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment