Skip to content

Instantly share code, notes, and snippets.

@JulieKuehl
Created October 31, 2013 00:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JulieKuehl/7242580 to your computer and use it in GitHub Desktop.
Save JulieKuehl/7242580 to your computer and use it in GitHub Desktop.
Set default author for Community Event submissions (The Event Calendar) (courtesy Jonathan Brinley)
add_filter( 'wp_insert_post_data', 'my_filter_community_submission_author', 10, 1 );
function my_filter_community_submission_author( $post_data ) {
if ( !empty( $_POST[ 'community-event' ] ) && $post_data['post_type'] == TribeEvents::POSTTYPE && empty( $post_data['post_author'] ) && !is_user_logged_in() ) {
$post_data['post_author'] = $the_id_of_the_user_you_want_as_the_author;
}
return $post_data;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment