Skip Navigation

[Resolved] _wpcf_belongs working with some post types and not others

This thread is resolved. Here is a description of the problem and solution.

Problem:

In Toolset post form, I see below error message:

There is a problem with _wpcf_belongs_district_id field. Please check CRED form.

Solution:

The field "_wpcf_belongs_district_id field" works for legacy post type relationship, and your website have already migrated to new post type relationships.

So you will need to edit those Toolset post forms to setup new relationship field, for example:

https://toolset.com/forums/topic/_wpcf_belongs-working-with-some-post-types-and-not-others/#post-1218528

Relevant Documentation:

https://toolset.com/documentation/user-guides/cred-shortcodes/#cred_field

This support ticket is created 5 years, 10 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.

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

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 2 replies, has 2 voices.

Last updated by Purchasing WCER 5 years, 10 months ago.

Assisted by: Luo Yang.

Author
Posts
#1218317

I am trying to: I'd like the form on these 3 pages: hidden link, hidden link, hidden link
to show a dropdown of parent posts (districts) to select from. This will set the relationship between the child post and the parent post (district) It works fine with the exact same code here: hidden link

On the other 3 pages I get this error:

There is a problem with _wpcf_belongs_district_id field. Please check CRED form.

Link to a page where the issue can be seen: hidden link, hidden link, hidden link

I expected to see: a dropdown of parent post titles

Instead, I got:
this message...There is a problem with _wpcf_belongs_district_id field. Please check CRED form.

#1218528

Hello,

Thanks for the details, I can login into your website and see the problem.

The field "_wpcf_belongs_district_id field" works for legacy post type relationship, and your website have already migrated to new post type relationships:
hidden link

So you will need to edit those Toolset post forms to setup new relationship field, for example, edit post form "Create Demographic Data"
hidden link

replace this shortcode from:

[cred_field field='_wpcf_belongs_district_id' value='' order='title' ordering='asc' required='true' select_text='--- not set ---' validate_text='district must be selected' class='form-control' output='bootstrap' use_select2="never"]

To:

[cred_field scaffold_field_id='@district_demographic-data.parent' field='@district_demographic-data.parent' class='form-control' output='bootstrap' select_text='--- not set ---' label='district_demographic-data' required='true' validate_text='district must be selected' use_select2='never']

You can insert above shortcode with UI, for example, in section "Form Editor", click button "Add fields", in section "Relationships", click button "district_demographic-data".

And test it in front-end:
hidden link

You should be able to see the relationship field in the post form

More help:
https://toolset.com/documentation/user-guides/cred-shortcodes/#cred_field

#1219110

This worked perfectly. My issue is resolved now. Thank you!