Changeset 53183 for trunk/src/wp-admin/includes/ajax-actions.php
- Timestamp:
- 04/14/2022 03:13:45 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/ajax-actions.php
r53123 r53183 3951 3951 3952 3952 /** This filter is documented in wp-admin/includes/class-custom-image-header.php */ 3953 $cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication.3954 $ object= $wp_site_icon->create_attachment_object( $cropped, $attachment_id );3955 unset( $ object['ID'] );3953 $cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication. 3954 $attachment = $wp_site_icon->create_attachment_object( $cropped, $attachment_id ); 3955 unset( $attachment['ID'] ); 3956 3956 3957 3957 // Update the attachment. 3958 3958 add_filter( 'intermediate_image_sizes_advanced', array( $wp_site_icon, 'additional_sizes' ) ); 3959 $attachment_id = $wp_site_icon->insert_attachment( $ object, $cropped );3959 $attachment_id = $wp_site_icon->insert_attachment( $attachment, $cropped ); 3960 3960 remove_filter( 'intermediate_image_sizes_advanced', array( $wp_site_icon, 'additional_sizes' ) ); 3961 3961 … … 3989 3989 3990 3990 // Get the original image's post to pre-populate the cropped image. 3991 $original_attachment 3992 $sanitized_post_title 3993 $use_original_title 3991 $original_attachment = get_post( $attachment_id ); 3992 $sanitized_post_title = sanitize_file_name( $original_attachment->post_title ); 3993 $use_original_title = ( 3994 3994 ( '' !== trim( $original_attachment->post_title ) ) && 3995 3995 /* … … 4002 4002 $use_original_description = ( '' !== trim( $original_attachment->post_content ) ); 4003 4003 4004 $ object = array(4004 $attachment = array( 4005 4005 'post_title' => $use_original_title ? $original_attachment->post_title : wp_basename( $cropped ), 4006 4006 'post_content' => $use_original_description ? $original_attachment->post_content : $url, … … 4012 4012 // Copy the image caption attribute (post_excerpt field) from the original image. 4013 4013 if ( '' !== trim( $original_attachment->post_excerpt ) ) { 4014 $ object['post_excerpt'] = $original_attachment->post_excerpt;4014 $attachment['post_excerpt'] = $original_attachment->post_excerpt; 4015 4015 } 4016 4016 4017 4017 // Copy the image alt text attribute from the original image. 4018 4018 if ( '' !== trim( $original_attachment->_wp_attachment_image_alt ) ) { 4019 $ object['meta_input'] = array(4019 $attachment['meta_input'] = array( 4020 4020 '_wp_attachment_image_alt' => wp_slash( $original_attachment->_wp_attachment_image_alt ), 4021 4021 ); 4022 4022 } 4023 4023 4024 $attachment_id = wp_insert_attachment( $ object, $cropped );4024 $attachment_id = wp_insert_attachment( $attachment, $cropped ); 4025 4025 $metadata = wp_generate_attachment_metadata( $attachment_id, $cropped ); 4026 4026
Note: See TracChangeset
for help on using the changeset viewer.