WordPress.org

Make WordPress Core

Ticket #25236: media.patch

File media.patch, 712 bytes (added by pross, 7 years ago)
  • wp-admin/includes/media.php

    diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php
    index b76bac2..cb116f5 100644
    a b function media_post_single_attachment_fields_to_edit( $form_fields, $post ) { 
    917917function image_attachment_fields_to_save($post, $attachment) {
    918918        if ( substr($post['post_mime_type'], 0, 5) == 'image' ) {
    919919                if ( strlen(trim($post['post_title'])) == 0 ) {
    920                         $post['post_title'] = preg_replace('/\.\w+$/', '', basename($post['guid']));
     920                        $post['post_title'] = preg_replace('/\.\w+$/', '', basename($post['attachment_url']));
    921921                        $post['errors']['post_title']['errors'][] = __('Empty Title filled from filename.');
    922922                }
    923923        }