Support

Account

Home Forums Front-end Issues Repeater and Flexible Fields not Saving Values from FrontEnd Reply To: Repeater and Flexible Fields not Saving Values from FrontEnd

  • I tried like you suggest.

    add_filter('acf/pre_save_post' , 'tsm_do_pre_save_post' );
    function tsm_do_pre_save_post( $post_id ) {
    
    	// Bail if not logged in or not able to post
    	if ( ! ( can_user_post_recipe() ) ) {
    		return $post_id;
    	}
    
    	// check if this is to be a new post
    	if( $post_id != 'new' ) {
    		return $post_id;
    	}
    
    	// Create a new post
    	$post = array(
    		'post_type'     => 'post', 
    		'post_status'   => 'pending', 
    		'post_title'    => wp_strip_all_tags($_POST['acf']['field_559a8e6366915']), // Post Title ACF field key
    		'post_content'  => $_POST['acf']['field_559a8e7b66916'], // Post Content ACF field key
    	);
    
    	$post_id = wp_insert_post( $post );
    	
    	wp_set_object_terms($post_id, array(1829), 'category');
    	
    	// ACF image field key
    	$image = $_POST['acf']['field_559a8eb766918'];
    	
    	// Bail if image field is empty
    	if ( empty($image) ) {
    		return $post_id;
    	}
    
    	// 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 );
    
    	return $post_id;
    	
    }

    Now the wp_set_object_terms seems to work nicely, but the thumbnail is not saved at all, and the original issue is still there: no repeater or flexible field saved in db.

    Maybe I did not say this: in backend everything is working fine (since a lot of time)

    I can’t see any error, not js in console, not php in server log.