Broken media library SEARCH with Newspaper activated

Posted in: Newspaper
Post count: 29

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 topic was modified 8 years by Lecache.
  • This topic was modified 8 years by Lecache.
  • This topic was modified 8 years by Lecache.
Post count: 29

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…

Post count: 20688

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

Post count: 29

Good find Simion, going to try this ! Thank you

Maybe a new feature allowing what to display in search results (posts and pages, or only posts) for next releases of your great Newspaper theme ? 😉

Post count: 20688

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

Viewing 5 posts - 1 through 5 (of 5 total)
The forum ‘Newspaper’ is closed to new topics and replies.