]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/revision.php
WordPress 4.7
[autoinstalls/wordpress.git] / wp-includes / revision.php
index b588621944d02907df01146df1eefc584b1c4f87..c166fbf13199bf566709ee46b2153e88733d3671 100644 (file)
@@ -321,9 +321,10 @@ function _wp_put_post_revision( $post = null, $autosave = false ) {
  * @since 2.6.0
  *
  * @param int|WP_Post $post   The post ID or object.
  * @since 2.6.0
  *
  * @param int|WP_Post $post   The post ID or object.
- * @param string      $output Optional. OBJECT, ARRAY_A, or ARRAY_N.
+ * @param string      $output Optional. The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which correspond to
+ *                            a WP_Post object, an associative array, or a numeric array, respectively. Default OBJECT.
  * @param string      $filter Optional sanitation filter. See sanitize_post().
  * @param string      $filter Optional sanitation filter. See sanitize_post().
- * @return WP_Post|array|null Null if error or post object if success.
+ * @return WP_Post|array|null WP_Post (or array) on success, or null on failure.
  */
 function wp_get_post_revision(&$post, $output = OBJECT, $filter = 'raw') {
        if ( !$revision = get_post( $post, OBJECT, $filter ) )
  */
 function wp_get_post_revision(&$post, $output = OBJECT, $filter = 'raw') {
        if ( !$revision = get_post( $post, OBJECT, $filter ) )
@@ -594,7 +595,13 @@ function _wp_preview_post_thumbnail_filter( $value, $post_id, $meta_key ) {
                return $value;
        }
 
                return $value;
        }
 
-       if ( empty( $_REQUEST['_thumbnail_id'] ) || $post->ID != $post_id || '_thumbnail_id' != $meta_key || 'revision' == $post->post_type ) {
+       if ( empty( $_REQUEST['_thumbnail_id'] ) ||
+            empty( $_REQUEST['preview_id'] ) ||
+            $post->ID != $post_id ||
+            '_thumbnail_id' != $meta_key ||
+            'revision' == $post->post_type ||
+            $post_id != $_REQUEST['preview_id']
+       ) {
                return $value;
        }
 
                return $value;
        }