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 would remove the acf/save_post filter from the code entirely. Everything you’re doing there should be done in the pre_save_post filter.

    I did see another error in the pre_save_post filter, but I’m not sure that would effect anything either.

    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() ) ) {
                    // added $post_id here
    		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 );
    	// more stuff from save post filter to here
    	// ACF image field key
    	$image = $_POST['acf']['field_559a8eb766918'];
    	// Bail if image field is empty
    	if ( empty($image) ) {
                    // added $post_id to return
    		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;

    Other than that, I don’t see anything wrong with your code. If you make these changes and it’s still not working then you may have something else that’s causing some interference.