Support

Account

Home Forums Add-ons Repeater Field Repeater field saved in content Reply To: Repeater field saved in content

  • This is my code

    
    add_filter('acf/pre_save_post' , 'rtm_pre_save_post' );
    function rtm__save_post( $post_id ) {
      $category = $_POST['acf']['field_54dfccb977a11']; 
      $pasiPregatire = $_POST['acf']['field_58197932d0cff']; // << i know this is an array and won't work
       $postContent = $_POST['acf']['field_54dfc94e35ec5'] /* << text area field */ .   $pasiPregatire	;
    // 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_54dfc93e35ec4']),
    		'post_content'  => $postContent,
    		'post_category'  => array($category),
    	);
    	// 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;
    }

    But i don’t realize how to put $pasiPregatire (even with the foreach loop) in $postContent