Support

Account

Home Forums Bug Reports ACF 5.4 preview changes no longer works Reply To: ACF 5.4 preview changes no longer works

  • Hi @leapxd

    Good news

    This issue has now been fixed. Please re-download the plugin files and copy across the api/api-helpers.php file or make the following code change on line ~744:

    
    function acf_verify_nonce( $value, $post_id = 0 ) {
    	
    	// vars
    	$nonce = acf_maybe_get( $_POST, '_acfnonce' );
    	
    	
    	// bail early if no nonce or if nonce does not match (post|user|comment|term)
    	if( !$nonce || !wp_verify_nonce($nonce, $value) ) {
    		
    		return false;
    		
    	}
    	
    	
    	// if saving specific post
    	if( $post_id ) {
    		
    		// vars
    		$form_post_id = (int) acf_maybe_get( $_POST, 'post_ID' );
    		$post_parent = wp_is_post_revision( $post_id );
    		
    			
    		// 1. no $_POST['post_id'] (shopp plugin)
    		if( !$form_post_id ) {
    			
    			// do nothing (don't remove this if statement!)
    			
    		// 2. direct match (this is the post we were editing)
    		} elseif( $post_id === $form_post_id ) {
    			
    			// do nothing (don't remove this if statement!)
    			
    		// 3. revision (this post is a revision of the post we were editing)
    		} elseif( $post_parent === $form_post_id ) {
    			
    			// return true early and prevent $_POST['_acfnonce'] from being reset
    			// this will allow another save_post to save the real post
    			return true;
    			
    		// 4. no match (this post is a custom created one during the save proccess via either WP or 3rd party)
    		} else {
    			
    			// return false early and prevent $_POST['_acfnonce'] from being reset
    			// this will allow another save_post to save the real post
    			return false;
    			
    		}
    		
    	}
    	
    	
    	// reset nonce (only allow 1 save)
    	$_POST['_acfnonce'] = false;
    	
    	
    	// return
    	return true;
    		
    }