Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a site using Advanced Custom Fields to create and store various bits of relevant info. These need to be included in the main general search, which by default only searches the title and main content.

I've found plenty of info about getting search results based on specific bits of postmeta, but I have an issue with that. There are a potentially unlimited amount of potential fields in postmeta to search.

The solution could either search anything in postmeta or anything with a meta_key that matches this regex: content_section_[0-9]{1,4}_content_.{2,8}

Example meta_keys to match are:

content_section_0_content_title
content_section_0_content_title
content_section_4_content_subtitle
content_section_8_content_text

Any way that I can alter the fields searched to include the postmeta would be very much appreciated.

share|improve this question
    
and the question is? –  Naoise Golden Dec 8 '11 at 21:31
    
Searching in Wordpress doesn't search data from the post meta - it only searches the title and content fields. I'll update the main question to clarify. –  Magnakai Dec 9 '11 at 0:53

2 Answers 2

up vote 2 down vote accepted

If your up for using a plugin, Relevanssi - A Better Search might be worth trying out.

The standard (free) version supports searching post meta.

share|improve this answer

I not 100% sure, but to grab all the custom field keys/values for the default search would require a database call using wpdb.

The alternative plugin besides the ones goto10 mentioned are a much simpler solution. Search Everything, WP Custom Fields Search

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.