Support

Account

Home Forums ACF PRO Warnings with clean install of ACF Pro 5.0.9 and WP 4 Reply To: Warnings with clean install of ACF Pro 5.0.9 and WP 4

  • Hi guys

    I’ve got a fix for the issue and if you have time, please replace the following function into the api-helpers.php file:

    
    function acf_verify_nonce( $nonce, $post_id = 0 ) {
    	
    	// vars
    	$r = false;
    	
    	
    	// note: don't reset _acfnonce here, only when $r is set to true. This solves an issue caused by other save_post actions using this function with a different $nonce
    	
    	
    	// check
    	if( isset($_POST['_acfnonce']) ) {
    
    		// verify nonce 'post|user|comment|term'
    		if( is_string($_POST['_acfnonce']) && wp_verify_nonce($_POST['_acfnonce'], $nonce) ) {
    			
    			$r = true;
    			
    			
    			// remove potential for inifinite loops
    			$_POST['_acfnonce'] = false;
    			
    		
    			// if we are currently saving a revision, allow its parent to bypass this validation
    			if( $post_id && $parent = wp_is_post_revision($post_id) ) {
    				
    				// revision: set parent post_id
    				$_POST['_acfnonce'] = $parent;
    				
    			}
    			
    		} elseif( $_POST['_acfnonce'] === $post_id ) {
    			
    			$r = true;
    			
    			// remove potential for inifinite loops
    			$_POST['_acfnonce'] = false;
    			
    		}
    		
    	}
    		
    	
    	// return
    	return $r;
    	
    }
    

    Please also let me know if this solves the issue for you

    Thanks
    E