mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 17:48:01 +01:00
Use correct array key for filling the attachment title in image_attachment_fields_to_save(). props pross.
Use wp_basename() to avoid issues with UTF-8 characters. fixes #25236. Built from https://develop.svn.wordpress.org/trunk@25277 git-svn-id: http://core.svn.wordpress.org/trunk@25242 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
14308c0d41
commit
897ddbd76c
@ -917,7 +917,8 @@ function media_post_single_attachment_fields_to_edit( $form_fields, $post ) {
|
||||
function image_attachment_fields_to_save( $post, $attachment ) {
|
||||
if ( substr( $post['post_mime_type'], 0, 5 ) == 'image' ) {
|
||||
if ( strlen( trim( $post['post_title'] ) ) == 0 ) {
|
||||
$post['post_title'] = preg_replace('/\.\w+$/', '', basename($post['guid']));
|
||||
$attachment_url = ( isset( $post['attachment_url'] ) ) ? $post['attachment_url'] : $post['guid'];
|
||||
$post['post_title'] = preg_replace( '/\.\w+$/', '', wp_basename( $attachment_url ) );
|
||||
$post['errors']['post_title']['errors'][] = __( 'Empty Title filled from filename.' );
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user