Hi
I am using the code snippet mentioned here:
https://toolset.com/forums/topic/change-author-attribution-on-cred-form-submitted-content/#post-609667
But for some reason its not working.
The exact code I am using is:
add_action('cred_save_data', 'func_set_custom_author',10,2);
function func_set_custom_author($post_id, $form_data){
// if a specific form
if ($form_data['id']==66944){
$my_post = array(
'ID' => $post_id,
'post_author' => 51
);
// Update the post into the database
wp_update_post( $my_post );
}
}
66944 being my form ID and 51 being the user I want all posts to be assigned to on this form submission. This form is on the front end and available for guests to complete.
Thanks.
My issue is resolved now. Thank you!