Skip Navigation

[Resolved] Search posts by multiple checkboxes field value

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.

This topic contains 2 replies, has 2 voices.

Last updated by poM 1 year, 3 months ago.

Assisted by: Christopher Amirian.

Author
Posts
#2542095

poM

Hi,

I have a custom post (region) with a multiple checkboxes field (departements).

I need to find region posts by a given department value with PHP and WP_Query.

How can I do that ?

Chhers

#2543643

Christopher Amirian
Supporter

Languages: English (English )

Hi there,

You can check the WP_Query details on how to do so:

https://developer.wordpress.org/reference/classes/wp_query/

Toolset uses the standard WordPress functions to add custom fields and custom post types. The only thing that you need to do is to add the slug of the custom field using the prefix so for you: wpcf_ departments

Thanks.

#2544073

poM

Hi,

I finally worked it out with custom views.

This is to complex to query fields wi the serialized values.

Cheers

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.