Support

Account

Home Forums ACF PRO Infinite loop using acf/update_value/key filter

Solved

Infinite loop using acf/update_value/key filter

  • Since I updated ACF from 5.2.7 to 5.3.0 I got an infinite loop while saving a post. I am not sure what infos you need, but I can send you the part that causing the issue.

    
    // in class constructor
    add_filter( 'acf/update_value/key=fund_name', array( $this, 'update_post_title' ), 10, 3 );
    add_filter( 'acf/update_value/key=fund_description', array( $this, 'update_post_content' ), 10, 3 );
    // class methods
    /**
     * Update post title after saving country selection
     *
     * @param $value
     * @param $post_id
     * @param $field
     *
     * @return mixed
     */
    function update_post_title( $value, $post_id, $field ) {
    
    	// update post
    	$my_post = array(
    		'ID'         => $post_id,
    		'post_title' => $value,
    	);
    
    	wp_update_post( $my_post );
    
    	return $value;
    }
    
    /**
     * Update post content after saving description
     *
     * @param $value
     * @param $post_id
     * @param $field
     *
     * @return mixed
     */
    function update_post_content( $value, $post_id, $field ) {
    	// update post
    	$my_post = array(
    		'ID'           => $post_id,
    		'post_content' => $value,
    	);
    
    	wp_update_post( $my_post );
    
    	return $value;
    }

    Thanks for checking this issue.

  • Sorry, I haven’t seen the notice that no support tickets are created. I will also create a support ticket.

  • This has been coming up a bit lately here. Take a look at this topic, it has some information on what needs to be done. http://support.advancedcustomfields.com/forums/topic/update-value-function-causes-timeout/

  • Thanks a lot. This was the trick. 🙂

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Infinite loop using acf/update_value/key filter’ is closed to new replies.