Hello. Thank you for contacting the Toolset support.
Well - I see you are using the checkbox field type to display the taxonomy terms. To attach the parent post terms to child posts automatically, I suggest you should use Toolset forms hook cred_save_data.
For example:
add_action('cred_save_data', 'func_set_parent_terms_to_child',20,2);
function func_set_parent_terms_to_child($post_id, $form_data){
// if a specific form
if ($form_data['id']==9999) {
$parent_post_id = 111; // adjust your parent post ID here
$parent_terms = wp_get_object_terms( $parent_post_id, 'item', array('ids') );
if(!empty($parent_terms)) {
$parent_term_ids = array();
foreach($parent_terms as $parent_term) {
if($parent_term->term_id != '') {
$parent_term_ids[] = $parent_term->term_id;
}
}
if(count($parent_term_ids) > 0) {
wp_set_object_terms( $post_id, $parent_term_ids , 'item' );
}
}
}
}
Thanks for your suggestion Minesh. Unfortunately the supplied code doesn't work... I've set the form ID correctly, and tried setting $parent_post_id using both $post_id and specifying it manually, and unfortunately the child post does not inherit the parent's "items"... Any idea why that might be?
Well - it will set automatically, this code will not affect GUI display but it will try to set parent taxonomy terms automatically.
Can you share problem URL and access details?
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).
I have set the next reply to private which means only you and I have access to it.
OK, it's working now. I realised I still had the GUI for selecting taxonomy terms on my CRED form which must have been overwriting the terms the function was trying to save. Thanks!