Skip Navigation

[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.

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

Supporter timezone: Europe/Madrid (GMT+02:00)

This topic contains 3 replies, has 3 voices.

Last updated by Juan 7 years, 3 months ago.

Assisted by: Juan.

Author
Posts
#446214

Is there any way to populate a checkboxes custom field with values from the database? This is for Types, when editing a custom post type in wp-admin.

I have searched high and low in this forum and found the wpt_field_options filter, but it only works on select-fields.

I need to pull in the titles and IDs of all published posts in a specific post type.

Is there anything like wpt_field_options for checkboxes?

#446430

Dear Jakob,

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.

#447058

Yes, please add it as a feature request.

Do you have a list of feature requests somewhere?

#475416

Juan
Supporter

Timezone: Europe/Madrid (GMT+02:00)

Hi Jakob

Thanks for the feedback.

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.