Tell us what you are trying to do?
I allow members to upload an embed video, I also allow them to choose from a variety of categories. but I also want each video to have an additional category ( Default:video ) one as well
Is there any documentation that you are following?
I have seen some but they do not really meet my requirements
Is there a similar example that we can see?
None that I know of
What is the link to your site?
hidden link
Hi,
Thank you for contacting us and I'd be happy to assist.
To suggest the best way to achieve this, I'll need to see how this form and the category terms are set up in the admin area.
Can you please share temporary admin login details, along with a link to a page where this form can be seen?
Note: Your next reply will be private and please make a complete backup copy, before sharing the access details.
regards,
Waqar
Thank you for sharing the admin access.
During testing on my website with a similar form and taxonomy setup, I was able to make this work, using the "cred_save_data" hook:
( ref: https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data )
add_action('cred_save_data','attach_default_tax_func',15,2);
function attach_default_tax_func($post_id, $form_data) {
if ($form_data['id']==4544) {
$target_term_ID = '128';
$target_taxonomy = 'video-media-category';
wp_set_post_terms( $post_id, $target_term_ID, $target_taxonomy, true );
}
}
The above code snippet will make sure that the "video" term with ID "128" in the taxonomy "video-media-category" is also attached to the post created using the form "Video Submission" with ID "4544".
This snippet can be included through either Toolset's custom code feature ( ref: https://toolset.com/documentation/adding-custom-code/using-toolset-to-add-custom-code/ ) or through active theme's "functions.php" file.
I hope this helps and please let me know if you need any further assistance around this.