CSV and HTML search filter for WordPress

This is one of my WordPress plugins, made to add a simple ajax-search in html or in uploaded CSV-file.

The plugin has two shortcodes.

[csvsearch src='/path/file.csv']
[filtersearch search_element='table']


[csvsearch] is performing a search in an uploaded (or otherwise accessible) CSV-file. Use the format to set the output. use {0}, {1} etc for different columns in the file and {b}{/b}, {i}{/i} etc for simple formatting. Here is a sample with all arguments to use.


// url to uploaded file

// charset of file

// format the output
format='{b}{0}{/b}, {1}, {2}{br/}'

// format the output with link
format="{a href='{0}'}{1}{/a}"

// format the output with image
format="{img src='{0}' /}"

// search label

// format for output when instant search

// instant search enabled or not

// data ID format, i.e. what to put in data-id of the listed element.

// change the item separator depending on type of csv file used

// change the nothing found message
nothing_found_message='Nothing found when searching for: '

// If true, the shortcode will only find exact matches, case sensitive. Default false.

// Add text where search-result will be placed. Default none.
placeholder_text='Place some default text before searching.'



[filtersearch] does a filter inside current html page. Specify which element you want to search within. You cah use either element type, .class_name of #id. See sample below for more arguments that can be used.


// what DOM element to search in, use element type, .class_name or #id

// show table header or not when filtering

// filter heading 
text='Page filter'

// class to style clear icon

// clear filter text

// enable or disable to set focus in filter input element on page load

Live samples using the plugin

Use this [filtersearch] shortcode

[filtersearch search_element='#name_table' text='Filter name in table' show_header_in_table=true clear_text='Clear filter' set_focus_on_load=false]

which enables this filter

Filter name in tableclear filter

on this table (with id name_table)

First nameLast name

Use this [csvsearch] shortcode

[csvsearch src='/wp-content/uploads/2021/09/sample.csv' searchtext='Search in file' format='{b}{0} {1}{/b} {2} - {3}{br/}' nothing_found_message='No hits for: ']

to show this search

for a search in this csv-sample-file. Try searching for a name (I’m using the same sampel names as in the table above) or a favorite color (pink, blue, red, …) or lucky number (3, 6, 7, …) to see the results.


Download the plugin from wordpress.org.

Feel free to donate if you find the plugin useful 🙂


  1. Hello Jonas!

    We owe you a beer (or two) for this excellent plugin. It easily solved our problem of making our database available to the public.

    One question, though: is it possible to format the text output of the search results in preformatted font?

    I played with the output a bit, but couldn’t figure out which element to apply the formatting to.

    I appreciate your help!

      1. Thank you! You are great!
        I have one more question. In my csv file I have a zip code in the format: 00-110. How to make the results of 00- not appear after typing 00-? I want an answer if the question is exactly the answer.

        1. Hi again Tom.
          It depends a little what you need. Do you always want exactly match, or just on some of the columns? The fix to make a setting to always make exact matches is doable, but if you want the zip column to be exact match but for example a city name to match just part of the name it’s a bit more complex to fix 😉

          1. Now I added the argument exact_match you can add. Set exact_match=’true’ to make only exact matches to be shown. This will check for exact case sensitive matches. Should work for you.

  2. Compliment for the easy and functional plugin! Do you know if there is a function to display image from results ? I have try this: {img} and replace this tag, but this no work {img src=\”my_img_url\”} and also this {img src=\”my_img_url\{3}”} etc etc many thanks for you answer

    1. Hi Gian.

      I tried this now and it should work with setting parameter format to:

      format=”{img src=’/your_url/{3}’/}”
      format=”{img src='{3}’/}” if you have the complete image url in the file.

      Make sure to use double quotes and single quotes at the right places. (and if you copy and paste my sample you probably have to replace the quotes with correct ones, it doesn’t always work when copy pasting)

  3. can a csv be searched with multiple criteria/filters – e.g. search for rows that contain a match, for example, for Team Name = aa, Year = bb, Sport = cc

Leave a comment

Your email address will not be published.