Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: option to hide pages on search results #10

Open
hacheraw opened this issue Apr 7, 2019 · 1 comment
Open

Feature request: option to hide pages on search results #10

hacheraw opened this issue Apr 7, 2019 · 1 comment

Comments

@hacheraw
Copy link

hacheraw commented Apr 7, 2019

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!

@terrylinooo
Copy link
Owner

Okay.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants