I have a CRED form on our site that allows guest users (those who are not logged into an account) to submit a form that creates a post. Because I have no intention of letting these users have their own accounts on the site, I'd like to assign the post submission to a specific user, perhaps a dummy account that no real human uses, because otherwise it just assigns the post to the user that appears first alphabetically, and this is simply undesirable behavior.
Any help in this matter would be greatly appreciated. Thanks in advance!
For example, suppose that the form ID of your target form is '1234' and the dummy user that you'd like all guest posts to assign to has the ID '5678'. The custom function attached to the 'cred_save_data' hook will look like this:
function custom_set_guest_post_author($post_id, $form_data)
// check if a specific form
$args = array(
'ID' => $post_id,
'post_author' => 5678, // ID of the guest user
$res = wp_update_post( $args, true );