Changeset 58447 for trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php
- Timestamp:
- 06/20/2024 04:02:10 PM (5 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php
r58130 r58447 305 305 $attachment->guid = $url; 306 306 307 // If the title was not set, use the original filename. 308 if ( empty( $attachment->post_title ) && ! empty( $files['file']['name'] ) ) { 309 // Remove the file extension (after the last `.`) 310 $tmp_title = substr( $files['file']['name'], 0, strrpos( $files['file']['name'], '.' ) ); 311 312 if ( ! empty( $tmp_title ) ) { 313 $attachment->post_title = $tmp_title; 314 } 315 } 316 317 // Fall back to the original approach. 307 318 if ( empty( $attachment->post_title ) ) { 308 319 $attachment->post_title = preg_replace( '/\.[^.]+$/', '', wp_basename( $file ) );
Note: See TracChangeset
for help on using the changeset viewer.