mynote icon indicating copy to clipboard operation
mynote copied to clipboard

Feature request: option to hide pages on search results

Open hacheraw opened this issue 5 years ago • 1 comments

Is your feature request related to a problem? Please describe. User may want to only show posts on search results.

Describe the solution you'd like Add an option either to allow user to decide if they want to show post pages on search results.

  • This is a little function I use to exclude page type in search results:
//Exclude pages from WordPress Search
if (!is_admin()) {
    function wpb_search_filter($query) {
        if ($query->is_search) {
            $query->set('post_type', 'post');
        }
        return $query;
    }
    add_filter('pre_get_posts','wpb_search_filter');
}

Describe alternatives you've considered

  • The option may be in mynote-admin plugin instead of here.
  • An advanced option would let the user determine which pages to show on search results.

Additional context Also, an user is able to search an empty string: imagen

Thank you!

hacheraw avatar Apr 07 '19 12:04 hacheraw

Okay.

terrylinooo avatar Apr 07 '19 13:04 terrylinooo