Home Forums Backend Issues (wp-admin) 2nd + every other Post Preview throws notice


2nd + every other Post Preview throws notice

  • Setup:
    Multiple custom content item w/ ACF fields, one of which is a WYSIWYG editor;
    I do have WYSIWYG Editor includes Custom Format’s (for TinyMCE editor);

    1) In WP admin control panel, navigate to & click edit on existing content item
    2) Preview (displays just fine)
    3) Close the new tab that contains the preview – taking you back to the previous tab which has the content item.
    4) Preview – notice is thrown:
    Notice: Trying to get property of non-object in /wp-content/plugins/advanced-custom-fields/acf.php on line 213

    Normally I wouldn’t too concerned, however the notice means the information i’m looking for is not displayed.

    The 1st time you view the preview it’s fine, the 2nd time it breaks, and then every other time after that it breaks (odd = fine, even = broken/notice)

    Wordpress: 3.8.1
    ACF: 4.3.4

    Code section around 213:

     *  Override for preview
     *  If the $_GET['preview_id'] is set, then the user wants to see the preview data.
     *  There is also the case of previewing a page with post_id = 1, but using get_field
     *  to load data from another post_id.
     *  In this case, we need to make sure that the autosave revision is actually related
     *  to the $post_id variable. If they match, then the autosave data will be used, otherwise, 
     *  the user wants to load data from a completely different post_id
    if( isset($_GET['preview_id']) )
      $autosave = wp_get_post_autosave( $_GET['preview_id'] );
      if( $autosave->post_parent == $post_id )//LINE 213 - notice thrown here
        $post_id = intval( $autosave->ID );
  • Hi @GKrabach

    Thanks for the bug report.
    I’ll do some testing and get back to you soon.


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

The topic ‘2nd + every other Post Preview throws notice’ is closed to new replies.