Skip Navigation

[Resolved] Save a record to a category based on the field select

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 7 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

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 1 reply, has 2 voices.

Last updated by Luo Yang 7 years, 3 months ago.

Assisted by: Luo Yang.

Author
Posts
#561100
Screenshot_2.jpg
Screenshot_1.jpg

Good afternoon. On the local site I try to realize the possibility of selecting certain categories based on the value of another arbitrary field.

I came across a very interesting and detailed topic on the forum - https://toolset.com/forums/topic/restrict-user-to-select-one-category-only/page/2/.

With the help of these instructions I was able to output the categories I needed for the selection.

However, in message No. 550910 of that topic (https://toolset.com/forums/topic/restrict-user-to-select-one-category-only/page/2/#post-550910), Christian does not specify the actions , Which allow you to save the entry in the desired category. (- Added cred_save_data function to functions.php).

Help me correctly compose this function so that posts are stored in the desired category.

#561171

Dear Alex,

According to our support policy
https://toolset.com/toolset-support-policy/
You are asking a question about action hook "cred_save_data " of CRED plugin, could you provide a valid "Subscription" for the CRED plugin?

For your question:
Help me correctly compose this function so that posts are stored in the desired category.

It needs custom PHP codes, here are my suggest you try this:
1) when user submit the CRED form, use action "cred_save_data" to trigger a custom PHP function,
2) get the value of category, and save it into database with wordpress function wp_set_object_terms()

The forum ‘Types Community Support’ is closed to new topics and replies.