[Resolved] Populate Types checkboxes field with values from database
This support ticket is created 7 years, 6 months 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.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
You are right, the filter hook wpt_field_options works for custom select field and radio field, it does not work for the custom checkboxes field
\types\library\toolset\toolset-common\toolset-forms\classes\class.radios.php
Line 84: $options = apply_filters('wpt_field_options', $options, $title, 'select');
\types\library\toolset\toolset-common\toolset-forms\classes\class.select.php
Line 82: $options = apply_filters('wpt_field_options', $options, $title, 'select');
But there isn't similar filter hook in file "class.checkboxes.php", so there isn't similar feature for custom checkboxes field, if you agree, we can take it as a feature request.
As Luo stated, we do not have such a feature, mainly because checkboxes are a quite special field type and setting options for it is not as straight forward as adding them on a filter dynamically.
On the other hand, creating a set of checkboxes for posts that belong to a custom post type is something maybe best suited for a new, dedicated, custom field type. Types fields depending on options work best when dealing with pre-defined options: you ste the field and you fill th options that you want to offer. Populating them dynamically can be problematic, and dealing with posts can lead to further issues, as you will have to deal with situations like selected posts being deleted, etc etc.
In any case, it seems that what you are trying to do is to establish some kind of post relationship. May I ask for some more details? There might be another way to get the same result.
Regards.
This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.