#9230 closed enhancement (duplicate)
Option to search for posts, pages or both
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | low | Milestone: | |
| Component: | General | Version: | |
| Severity: | minor | Keywords: | search options pages posts needs-patch |
| Cc: | jidm |
Description
Hi.
I seriously believe that there should be an option to choose between search on 'any' or 'post'. This could be set from the admin panel.
In some projects i don't need/want to searh on pages, so i have to manually change 'any' for 'post' on wp-includes/query.php:
if ( !isset($qpost_type?) ) {
if ( $this->is_search )
$qpost_type? = 'any';
else
$qpost_type? = 'post';
I think this can't be hard to implement (an option in the backend, a row in wp_options [maybe wp_blogs in case of wpmu] and a modification on the code above to ask for that option).
Please consider implementing this.
Thanks!
Change History (6)
comment:4
FFEMTcJ
— 4 years ago
- Priority changed from normal to low
- Severity changed from normal to minor
comment:5
jidm
— 4 years ago
- Cc jidm added
I tried to make it work by using the following hack before the have_posts call:
<?php $wp_query->set('post_type', 'post'); ?>
But nothing happened. Please consider having a look on it, as it doesn't seem to be hard work, and is a plus feature for a minority of users.
Thanks!
comment:6
Denis-de-Bernardy
— 4 years ago
- Milestone Future Release deleted
- Resolution set to duplicate
- Status changed from new to closed
see #9785
We can add a filter so plugins and themes can change this. I don't think we need an option in the UI.