Page 1 of 1
Forum

Welcome to the Tweaking4All community forums!
When participating, please keep the Forum Rules in mind!

Topics for particular software or systems: Start your topic link with the name of the application or system.
For example “MacOS X – Your question“, or “MS Word – Your Tip or Trick“.

Please note that switching to another language when reading a post will not bring you to the same post, in Dutch, as there is no translation for that post!



Searching through c...
 
Share:
Notifications
Clear all

[Solved] Searching through contents of attachment files

4 Posts
3 Users
0 Likes
2,378 Views
(@gerardkangley)
New Member
Joined: 6 years ago
Posts: 2
Topic starter  

WordPress supports the uploading of attachment files natively, but the attachment search is possible only by title/name. Is there any wordpress plugin that search in the contents of attachment files as well?

Need some suggestions.


   
ReplyQuote
 Hans
(@hans)
Famed Member Admin
Joined: 11 years ago
Posts: 2678
 

Hi GerardKangley,

Not to my knowledge. It would mean that your server has to search and/or index all attachments (I assume you mean files like PDF, Word, ZIP, etc and not just images) - which would come with a lot of work (for the server).

This little code (add to functions.php - and beware that I have not tested this) will add searching for attachments, but it will not look into the attachments:

function attachment_search( $query ) {
    if ( $query->is_search ) {
       $query->set( 'post_type', array( 'post', 'attachment' ) );
       $query->set( 'post_status', array( 'publish', 'inherit' ) );
    }
 
   return $query;
}
add_filter( 'pre_get_posts', 'attachment_search' );

Your question is nothing new though, and I suppose the WordPress team has chosen not to include this because of resource concerns.
See for example this StackOverflow question where they suggest using Google for this. Some other suggestions are mentioned as well, but it looks like none really answer your question.


   
ReplyQuote
(@gerardkangley)
New Member
Joined: 6 years ago
Posts: 2
Topic starter  

Thanks for your suggestion Hans it's really helpful but I got the solution with the help of my friend. He suggested me to use the Wordpress Plugin named "Full Text Search" plugin. It's not only used for the searching website content but also searching the content through the attachments as well. It solves my problem.


   
ReplyQuote
(@chris62)
New Member
Joined: 6 years ago
Posts: 1
 

Hi gerardkangley. Thanks for suggesting the plugin but it is to inform you that name you mentioned of a plugin is not correct and it doesn't appear in any searches of a search engine. The plugin name I found is "Wordpress Full Text Search" and I think you are referring to the same one and might have forgot to write it's full name.
Are you agree with me or not? 


   
ReplyQuote
Share: