Inserting Media Search Form Into Posts Or Templates

I’ve got lots of plugin ideas but don’t have much time on developing recently, due to I’m fascinated by AngularJS since last November and prepare to grow my freelancing business. Despite that I still try to take some time to update my plugins based on suggestions from users.

Today I just pushed the latest version of Media Search Enhanced to, the major updates are inspired by a comment left here last week. Basically Don requested if I can make the plugin work on the frontend, so website visitors can search for media by all fields (title, caption, alt text, filename and terms).

I found it interesting because I’ve considered to implement functions like that but not sure if it’s of use enough. According to Don’s comment, it will be a very good idea.

So I made a major change that moved all main functions from admin class to public class in my plugin, and create a shortcode mse-search-form to insert a media search form into posts or templates. The media search form is a default WordPress search form but customized:

  1. Add a hidden field to force it only to search for attachment post type.
  2. Add a class name mse-search-form to help if user would like to modify the form with CSS.
  3. Two custom filters in the form: mse_search_form_class to change the form class name, mse_search_form_placeholder to change the input placeholder.

For now the frontend media search form might not be that helpful that it just display all media as posts in search results page. You have to custom the page to make sense of it, so maybe I should improve it in the next release by adding a media search results page or creating a media search results shortcode.

Other comments on the support forum proposed to display the media search results but group them by post id, and search for meta values. These opinions are useful to some extend so I’ll keep in mind. Your feedback is always welcome. Let’s improve the media search workflow together!

5 responses

  1. Media Search enhanced is a nice plugin. But if I should find it usefull myself, this is what i want:
    You should leave results with a search-field still standing, and a ‘Try a new search’.
    And you should as an administrator be able to discriminate with fields your Little search-machine will search in.
    And you should be able to make your own tags in your media – which other plugins off course do that.

    If you can do that I think you have made a very useable plugin. But for now I myself cant use it, because i wont have visiters getting all my Pictures up in a search-result – but certain pdf-files which I have tagged according to content. Can you see the problem?

    1. Yoren Chang Avatar
      Yoren Chang

      Hi, Geert, Thanks for your feedback, I’d really appreciate it.

      Front end media search form is still not ready to use for most websites, I understand and will try to improve it as soon as I can.

      In the future releases if I add any feature per your request, I’d love to notify you and hear back from you. Stay tuned.

  2. I believe this is the type of plugin I need for a current project as a “document search”. Do you have any more progress / insight on implementing this?

    Would be much appreciated!


    1. Yoren Chang Avatar
      Yoren Chang

      Hey Liz,

      Just have a look at the plugin. You can easily change the code to search only for the document media type.

  3. This plug in is exactly what i’ve been looking for. I am using the plug in on the front end as my site has a ton of images and I want to be able to let users search for the specific image they may want.

    My question is how do I customize the search results page? Can I have your plug in/short code point to ‘content-search-media.php’ search results PHP page? How would I do that? See example of your plug in on the page noted below.

Leave a Reply

Your email address will not be published. Required fields are marked *