Skip to content
  • Hot
  • Top
  • New

You have ... votes left in this category for this week!


Add ability to search wp_postmeta and other fields

Dave Hilditch shared this feature

November 7, 2017

Currently Super Speedy Search can search any custom post type, but it only searches the wp_posts title and description.

I’ve had a few requests from clients to add the ability to search wp_postmeta too. Rather than searching ALL of wp_postmeta, probably there will be a list of meta_keys provided to search against?

Because this is a search of wp_postmeta, it will require a SECOND search to occur (full text indexes cannot span multiple tables). This will mean the search speed will be slightly slower.

There are two key issues to be wary of:

  1. wp_postmeta typically has 20 – 100 times more rows than wp_posts
  2. free-text indexes do not work well against short text – i.e. if wp_postmeta contains a LARGE chunk of text then this search will behave well, but if wp_postmeta is 20 characters or so then it would not work well and a different solution would be required.


Leave a Reply

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