* @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().
- * @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 ) )
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;
}