Hello,
I have the latest version of the theme with latest wordpress, no extra plugins, no issue other than : search is broken when trying to search for a file in the wordpress media library.
For example, I have an image file in my library, named “twitter.jpg”.
When Newspaper is active, if I search for “twitter” in the media library, NO RESULT.
When I switch to Twenty Seventeen theme, if I search for “twitter”, image is showing in the results !
Can you please tell me if there is a fix for this bug ?
Thank you
This was actually caused by a filter I added in function.php filtering only articles in the main search of the theme.
function SearchFilter($query) {
if ($query->is_search) {
$query->set(‘post_type’, ‘post’);
}
return $query;
}
add_filter(‘pre_get_posts’,’SearchFilter’);
Problem is, it also impacted library search…
Hi,
So I believe that you want to remove pages from search results, or return only post results. Maybe wrap that code in a condition like the example provided here
– https://www.wpbeginner.com/wp-tutorials/how-to-exclude-pages-from-wordpress-search-results/
Then for you as admin the code will not apply and you can have all search results.
Thanks
I will add it on our list, it will be considered. However you could use a plugin, maybe this one
– https://ro.wordpress.org/plugins/search-exclude/
It should allow you to exclude specific pages, posts etc. or maybe even in bulk, from the search results.
Thanks