Skip to content

Instantly share code, notes, and snippets.

@vfontjr
Created May 4, 2020 19:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vfontjr/34e15b09173e75b262de7902f0ae27f9 to your computer and use it in GitHub Desktop.
Save vfontjr/34e15b09173e75b262de7902f0ae27f9 to your computer and use it in GitHub Desktop.
<?php
if ( ! is_admin() && $query->is_main_query() && $query->is_search ) {
<?php
dd_filter('pre_get_posts', 'vmf_filter_search');
function vmf_filter_search($query) {
if ( $query->is_search ) {
$query->set( 'post_type', array('post', 'page', 'portfolio') );
};
return $query;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment