Skip Navigation

[Resolved] Create a Search that searches Two Custom Post Types

This support ticket is created 3 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 1 reply, has 2 voices.

Last updated by Waqar 3 years, 1 month ago.

Assisted by: Waqar.

Author
Posts
#2182161

Tell us what you are trying to do?
I have 2 CPT: Tax Sales and Properties (1 tax sale can have multiple properties and 1 property can only have 1 tax sale)

The search is searching through several filters and the results will be information about the Properties.
hidden link

One of the filters is Tax Sale Date From to Tax Sale Date (this field is in the Tax Sales Custom Post Type)
The other 2 filters are custom fields from the Properties Custom Post Type.

How do you search through 2 custom post types? I can give you access to the website if you need.

This is the search we are trying to replicate in our site: hidden link (login: simsim/123456)

thanks

#2182525

Hi,

Thank you for contacting us and I'd be happy to assist.

The search filters for the custom fields and taxonomies can be used with only the post types where they are directly attached. This means that if your view is set to show the "Tax Sales" posts, then only the search filters for this post type's custom fields and taxonomies will work.

If you'll set the view to show the results from both post types "Tax Sales" and "Properties", then you'll be able to add the search filters for custom fields and taxonomies from both these post types. But, when the search filter for one post type's fields will be applied, the results from the other post type will be ignored, because, for those posts, that field will be empty/non-existent.

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar