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 most likely no translated for the post!





Share:
Notifications
Clear all

Searching through contents of attachment files  

  RSS

gerardkangley
(@gerardkangley)
New Member
Joined: 2 years ago
Posts: 2
July 16, 2018 11:57 PM  

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
(@hans)
Noble Member Admin
Joined: 7 years ago
Posts: 1437
July 17, 2018 1:12 AM  

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
(@gerardkangley)
New Member
Joined: 2 years ago
Posts: 2
July 18, 2018 8:13 AM  

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
(@chris62)
New Member
Joined: 2 years ago
Posts: 1
July 19, 2018 12:43 AM  

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: