WordPress.org

Make WordPress Core

Ticket #24477: revision.php.patch

File revision.php.patch, 648 bytes (added by itthinx, 6 years ago)

This patch adds the empty( $post ) check to the filter.

  • wp-includes/revision.php

     
    539539function _wp_preview_meta_filter( $value, $object_id, $meta_key, $single ) {
    540540        $post = get_post();
    541541
    542         if ( $post->ID != $object_id || ! in_array( $meta_key, _wp_post_revision_meta_keys() ) || 'revision' == $post->post_type )
     542        if ( empty( $post ) || $post->ID != $object_id || ! in_array( $meta_key, _wp_post_revision_meta_keys() ) || 'revision' == $post->post_type )
    543543                return $value;
    544544
    545545        $preview = wp_get_post_autosave( $post->ID );