Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Hunter Hawley
Hunter Hawley
3,948 Points

Getting Custom Post Types / Fields to show up in search

Hi there,

I am making a client account information database, basically just a way to keep up with my web design clients, in Wordpress. To do so, I have created a custom post type with the plugin "Custom Post Type UI" called 'accounts'. Now, using the plugin "Advanced Custom Fields", I have created some custom fields to fall under the post type.

I am trying to make this database searchable, since it will have client data in it. Now, how can I make it so that I can search a word that is in one of my custom fields, and have the post show up on the search page?

I have tried a couple plugins, but none of them have worked.

Any ideas?

3 Answers

Glad to hear you got it figured out, Hunter!

It took me a while to figure this out also - have a look at the Relevanssi plugin (http://www.relevanssi.com/). It's a bit fidgety to configure however I've had good results with it.

I hope this helps!

Hunter Hawley
Hunter Hawley
3,948 Points

After asking the question I found the plugin called Search Everything, which is SO EASY. Install it, and you are immediately searching all post types and fields! Woot Woot!

A lttile bit over my head atm this, but I did find this article on statckoverflow that's seems to answer what you are trying to achieve.

Hunter Hawley
Hunter Hawley
3,948 Points

I tried this method, but it only works with the title of those posts, which is where I was before. I am trying to open it like this.

One of my Custom Fields is Contact Name, and you type the name of the person you deal with from that company.

So I want to be able to type John Appleseed and have the company he works for, say, Kim's Construction, to appear in the search.php file.

Thanks for your answer though!

How about this article