For example - I've added the following code to "Custom Code" section offered by Toolset with the code snippet namely "toolset-custom-code":
- hidden link
add_action('cred_before_save_data', 'func_save_content_for_generic_field',10,1);
function func_save_content_for_generic_field($form_data) {
// if a specific form
if ($form_data['id']==198) {
if (isset($_POST['post_content_accepted']) and !empty($_POST['post_content_accepted']) ) {
$_POST['post_content'] = $_POST['post_content_accepted'];
}else if(isset($_POST['post_content_rejected']) and !empty($_POST['post_content_rejected']) ) {
$_POST['post_content'] = $_POST['post_content_rejected'];
}
}
}
The above code will assign the selected post content (accepted or rejected) to the default post_content.
Can you please check and let me know if that works now.
I've adjusted the code added to "Custom Code" section with code snippet "toolset-custom-code" as given under:
=> hidden link
add_action('cred_save_data', 'func_save_content_for_generic_field',10,2);
function func_save_content_for_generic_field($post_id, $form_data) {
// if a specific form
if ($form_data['id']==198) {
if (isset($_POST['post_content_accepted']) and !empty($_POST['post_content_accepted']) ) {
$post_content = $_POST['post_content_accepted'];
}else if(isset($_POST['post_content_rejected']) and !empty($_POST['post_content_rejected']) ) {
$post_content = $_POST['post_content_rejected'];
}
// add it to saved post meta
$my_post = array(
'ID' => $post_id,
'post_content' => $post_content
);
// Update the post into the database
wp_update_post( $my_post );
}
}
2) if I use [wpv-post-link item="@job-candidate.parent"] instead of [wpv-post-title item="@job-candidate.parent"] the the WYSIWYG field has not loaded and it doesn't work
It is strange that it doesn't work but it isn't fundamental