Sauter la navigation

[Résolu] Search posts by multiple checkboxes field value

This support ticket is created Il y a 2 années. 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.

Ce sujet contient 2 réponses, a 2 voix.

Dernière mise à jour par poM Il y a 2 années.

Assisté par: Christopher Amirian.

Auteur
Publications
#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

Les langues: Anglais (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