Skip Navigation

[Résolu] Checkboxes or taxonomy

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem:
Is it recommended to use taxonomies (with checkboxes) or checkboxes custom fields?

Solution:
If you intend to filter a View using these checkboxes you should probably use taxonomies rather than a checkboxes custom field, because within WordPress taxonomy filters are more performant that meta query filters (https://tomjn.com/2017/02/27/not-post-meta-bad/).

See the answer below for a more detailed discussion.

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

Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

Auteur
Publications
#619548

It is nothing new if I said that Toolset checkboxes works in some sort of unusual way (see many topics).

I need some explanation (as documentation is missing about it an specially some video tutorial).

For me is completely unclear when and how to use checkboxes.

1) Checkboxes and taxonomies obviously have mainly same principal characteristic:

- users can make multiple choices (to avoid here hierarchical feature of categories, as it is irrelevant for topic) and
- both can be used in Views (so, for CRED, searches, ...).

2) Main difference is 'Value to store' field (not exists for taxonomies) as it obviously have lot of the possible scenario's, as far as I saw on the forum.

QUESTION

If I do not intent to use hierarchical feature of category, generally, it looks more logical to use checkboxes field type (right or wrong).

Question is - what I should to use initially for 'Value to store' (default is always 1) for eventual easy extension of usage (in CRED, searches,....)?

Example is Languages. Should I use repeated Language name as 'Value to store' (English for English), let it to default 1, append it (as radio or select field), or what?

I know that there is obviously not such 'uniform' 'Value to store' (otherwise will be populated by Toolset initially), but I'm asking generally speaking. Logical answer is - let it to default = 1 and eventually later change it vs needs, but .... it is not so easy to decide and start to use it (instead of taxonomy) if I completely don't understand (or understand completely) the possibilities for extended usage of checkboxes.

#619615

Nigel
Supporter

Les langues: Anglais (English ) Espagnol (Español )

Fuseau horaire: Europe/London (GMT+00:00)

Hi Ljuba

If you intend to filter a View using these checkboxes you should probably use taxonomies rather than a checkboxes custom field, because within WordPress taxonomy filters are more performant that meta query filters (lien caché).

If you use checkboxes custom fields and at some point you want to display meaningful values (rather than the checkboxes themselves to be used as a filter) then those values need to be stored somewhere.

Types & Views give you two options. You can either store the value to display in the post meta table directly for the field (instead of the default 1), or you can specify values to display instead of what is stored against the field in the post meta table, which would then require an additional look-up.

One note of caution, we have reports of problems filtering when you set the "save 0 to the database" option if the field is unchecked, and so I would recommend not using that option until we have reviewed that issue.

#619738

Thanks a lot. Now is clear (for me).