Changeset 38263 for trunk/src/wp-includes/post.php
- Timestamp:
- 08/15/2016 07:15:48 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/post.php
r38201 r38263 3260 3260 } 3261 3261 3262 // Set or remove featured image.3263 if ( isset( $postarr['_thumbnail_id'] ) && ( post_type_supports( $post_type, 'thumbnail' ) || 'revision' === $post_type ) ) {3264 $thumbnail_id = intval( $postarr['_thumbnail_id'] );3265 if ( -1 === $thumbnail_id ) {3266 delete_post_thumbnail( $post_ID );3267 } else {3268 set_post_thumbnail( $post_ID, $thumbnail_id );3269 }3270 }3271 3272 3262 if ( ! empty( $postarr['meta_input'] ) ) { 3273 3263 foreach ( $postarr['meta_input'] as $field => $value ) { … … 3290 3280 if ( ! empty( $postarr['context'] ) ) { 3291 3281 add_post_meta( $post_ID, '_wp_attachment_context', $postarr['context'], true ); 3282 } 3283 } 3284 3285 // Set or remove featured image. 3286 if ( isset( $postarr['_thumbnail_id'] ) ) { 3287 $thumbnail_support = current_theme_supports( 'post-thumbnails', $post_type ) && post_type_supports( $post_type, 'thumbnail' ) || 'revision' === $post_type; 3288 if ( ! $thumbnail_support && 'attachment' === $post_type && $post_mime_type ) { 3289 if ( wp_attachment_is( 'audio', $post_ID ) ) { 3290 $thumbnail_support = post_type_supports( 'attachment:audio', 'thumbnail' ) || current_theme_supports( 'post-thumbnails', 'attachment:audio' ); 3291 } elseif ( wp_attachment_is( 'video', $post_ID ) ) { 3292 $thumbnail_support = post_type_supports( 'attachment:video', 'thumbnail' ) || current_theme_supports( 'post-thumbnails', 'attachment:video' ); 3293 } 3294 } 3295 3296 if ( $thumbnail_support ) { 3297 $thumbnail_id = intval( $postarr['_thumbnail_id'] ); 3298 if ( -1 === $thumbnail_id ) { 3299 delete_post_thumbnail( $post_ID ); 3300 } else { 3301 set_post_thumbnail( $post_ID, $thumbnail_id ); 3302 } 3292 3303 } 3293 3304 }
Note: See TracChangeset
for help on using the changeset viewer.