$new_post = array( 'post_id' => 'new_post', // Create a new post // PUT IN YOUR OWN FIELD GROUP ID(s) 'field_groups' => array(7,58), // Create post field group ID(s) Example is given in below image 'form' => true, 'return' => '%post_url%', // Redirect to new post url 'html_before_fields' => '', 'html_after_fields' => '', 'submit_value' => 'Submit Post', 'updated_message' => 'Saved!' ); acf_form( $new_post );
Find your field_groups id from ACF menu –

Now, Submitting the form
add_filter('acf/pre_save_post' , 'save_post_from_frontend' );
function save_post_from_frontend( $post_id ) {
//Check if user loggin or can publish post
if ( ! ( is_user_logged_in() || current_user_can('publish_posts') ) ) {
return;
}
// check if this is to be a new post
if( $post_id != 'new_post' ) {
return $post_id;
}
$post = array(
'post_type' => 'post', // Your post type ( post, page, custom post type )
'post_status' => 'publish', // (publish, draft, private, etc.)
'post_title' => wp_strip_all_tags($_POST['acf']['field_54dfc93e35ec4']), // Post Title ACF field key
'post_content' => $_POST['acf']['field_54dfc94e35ec5'], // Post Content ACF field key
);
// insert the post
$post_id = wp_insert_post( $post );
// Save the fields to the post
do_action( 'acf/save_post' , $post_id );
return $post_id;
}
Now, Save ACF image field to post Featured Image
add_action( 'acf/save_post', 'save_image_field_to_featured_image', 10 );
function save_image_field_to_featured_image( $post_id ) {
$image = $_POST['acf']['field_54dfcd4278d63'];
// Bail if image field is empty
if ( empty($image) ) {
return;
}
// Add the value which is the image ID to the _thumbnail_id meta data for the current post
add_post_meta( $post_id, '_thumbnail_id', $image );
}
