I have a search form for categories only on the blog page. To keep pages from showing in the results I am using a function in the functions.php file.
function SearchFilter($query) {
if ($query->is_search) {
$query->set('post_type', 'post');
}
return $query;
}
add_filter('pre_get_posts','SearchFilter');
But this function also filters out the pages from the search results when doing a Page Search in the admin on the All Pages page. It will only show category post in the results.
How can I modify the function to allow pages to show only when using the search in the admin?
WordPress v3.2.1