Changeset 25277 for trunk/src/wp-admin/includes/media.php
- Timestamp:
- 09/06/2013 02:09:07 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/media.php
r25083 r25277 915 915 * @return array 916 916 */ 917 function image_attachment_fields_to_save($post, $attachment) { 918 if ( substr($post['post_mime_type'], 0, 5) == 'image' ) { 919 if ( strlen(trim($post['post_title'])) == 0 ) { 920 $post['post_title'] = preg_replace('/\.\w+$/', '', basename($post['guid'])); 921 $post['errors']['post_title']['errors'][] = __('Empty Title filled from filename.'); 917 function image_attachment_fields_to_save( $post, $attachment ) { 918 if ( substr( $post['post_mime_type'], 0, 5 ) == 'image' ) { 919 if ( strlen( trim( $post['post_title'] ) ) == 0 ) { 920 $attachment_url = ( isset( $post['attachment_url'] ) ) ? $post['attachment_url'] : $post['guid']; 921 $post['post_title'] = preg_replace( '/\.\w+$/', '', wp_basename( $attachment_url ) ); 922 $post['errors']['post_title']['errors'][] = __( 'Empty Title filled from filename.' ); 922 923 } 923 924 } … … 926 927 } 927 928 928 add_filter( 'attachment_fields_to_save', 'image_attachment_fields_to_save', 10, 2);929 add_filter( 'attachment_fields_to_save', 'image_attachment_fields_to_save', 10, 2 ); 929 930 930 931 /**
Note: See TracChangeset
for help on using the changeset viewer.