#9230 closed enhancement (duplicate)
Option to search for posts, pages or both
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | low | |
Severity: | minor | Version: | |
Component: | General | Keywords: | search options pages posts needs-patch |
Focuses: | Cc: |
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)
#5
@
16 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!
We can add a filter so plugins and themes can change this. I don't think we need an option in the UI.