diff --git a/wp-admin/css/wp-admin.css b/wp-admin/css/wp-admin.css index f4e2351398..0128cdef12 100644 --- a/wp-admin/css/wp-admin.css +++ b/wp-admin/css/wp-admin.css @@ -3407,6 +3407,10 @@ td.plugin-title p { display: none; } +#post-body-content .compat-attachment-fields { + margin-bottom: 20px; +} + .compat-attachment-fields th { padding-top: 5px; padding-right: 10px; @@ -4391,6 +4395,10 @@ span.imgedit-scale-warn { padding: 2px 10px; } +.wp_attachment_details { + margin-bottom: 20px; +} + /*------------------------------------------------------------------------------ 15.0 - Comments Screen ------------------------------------------------------------------------------*/ diff --git a/wp-admin/edit-form-advanced.php b/wp-admin/edit-form-advanced.php index d0b1ed579d..7d142d9af4 100644 --- a/wp-admin/edit-form-advanced.php +++ b/wp-admin/edit-form-advanced.php @@ -107,7 +107,6 @@ if ( 'attachment' == $post_type ) { wp_enqueue_script( 'image-edit' ); wp_enqueue_style( 'imgareaselect' ); add_meta_box( 'submitdiv', __('Save'), 'attachment_submit_meta_box', null, 'side', 'core' ); - add_meta_box( 'attachmentdata', __('Attachment Page Content'), 'attachment_content_meta_box', null, 'normal', 'core' ); add_action( 'edit_form_after_title', 'edit_form_image_editor' ); } else { add_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', null, 'side', 'core' ); diff --git a/wp-admin/includes/ajax-actions.php b/wp-admin/includes/ajax-actions.php index c33e383776..c39effe75e 100644 --- a/wp-admin/includes/ajax-actions.php +++ b/wp-admin/includes/ajax-actions.php @@ -1884,6 +1884,9 @@ function wp_ajax_save_attachment() { if ( isset( $changes['caption'] ) ) $post['post_excerpt'] = $changes['caption']; + if ( isset( $changes['description'] ) ) + $post['post_content'] = $changes['description']; + if ( isset( $changes['alt'] ) ) { $alt = get_post_meta( $id, '_wp_attachment_image_alt', true ); $new_alt = stripslashes( $changes['alt'] ); @@ -1923,10 +1926,6 @@ function wp_ajax_save_attachment_compat() { if ( 'attachment' != $post['post_type'] ) wp_send_json_error(); - // Handle the description field automatically, if a plugin adds it back. - if ( isset( $attachment_data['post_content'] ) ) - $post['post_content'] = $attachment_data['post_content']; - $post = apply_filters( 'attachment_fields_to_save', $post, $attachment_data ); if ( isset( $post['errors'] ) ) { diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php index e584b634e6..326505280c 100644 --- a/wp-admin/includes/media.php +++ b/wp-admin/includes/media.php @@ -1286,8 +1286,7 @@ function get_compat_media_markup( $attachment_id, $args = null ) { $default_args = array( 'errors' => null, - 'taxonomies' => false, - 'description' => false, + 'in_modal' => false, ); $user_can_edit = current_user_can( 'edit_post', $attachment_id ); @@ -1297,7 +1296,7 @@ function get_compat_media_markup( $attachment_id, $args = null ) { $form_fields = array(); - if ( $args['taxonomies'] ) { + if ( $args['in_modal'] ) { foreach ( get_attachment_taxonomies($post) as $taxonomy ) { $t = (array) get_taxonomy($taxonomy); if ( ! $t['public'] || ! $t['show_ui'] ) @@ -1329,19 +1328,18 @@ function get_compat_media_markup( $attachment_id, $args = null ) { $form_fields = apply_filters( 'attachment_fields_to_edit', $form_fields, $post ); unset( $form_fields['image-size'], $form_fields['align'], $form_fields['image_alt'], - $form_fields['post_title'], $form_fields['post_excerpt'], + $form_fields['post_title'], $form_fields['post_excerpt'], $form_fields['post_content'], $form_fields['url'], $form_fields['menu_order'], $form_fields['image_url'] ); - if ( ! $args['description'] ) - unset( $form_fields['post_content'] ); - $media_meta = apply_filters( 'media_meta', '', $post ); $defaults = array( - 'input' => 'text', - 'required' => false, - 'value' => '', - 'extra_rows' => array(), + 'input' => 'text', + 'required' => false, + 'value' => '', + 'extra_rows' => array(), + 'show_in_edit' => true, + 'show_in_modal' => true, ); $hidden_fields = array(); @@ -1361,6 +1359,9 @@ function get_compat_media_markup( $attachment_id, $args = null ) { $field = array_merge( $defaults, $field ); + if ( ( ! $field['show_in_edit'] && ! $args['in_modal'] ) || ( ! $field['show_in_modal'] && $args['in_modal'] ) ) + continue; + if ( $field['input'] == 'hidden' ) { $hidden_fields[$name] = $field['value']; continue; @@ -2282,12 +2283,12 @@ function edit_form_image_editor() { $att_url = wp_get_attachment_url( $post->ID ); - $image_edit_button = ''; - if ( wp_attachment_is_image( $post->ID ) && wp_image_editor_supports( array( 'mime_type' => $post->post_mime_type ) ) ) { - $nonce = wp_create_nonce( "image_editor-$post->ID" ); - $image_edit_button = " "; - } - + if ( wp_attachment_is_image( $post->ID ) ) : + $image_edit_button = ''; + if ( wp_image_editor_supports( array( 'mime_type' => $post->post_mime_type ) ) ) { + $nonce = wp_create_nonce( "image_editor-$post->ID" ); + $image_edit_button = " "; + } ?>
+ ID ); @@ -2348,7 +2364,12 @@ function attachment_submitbox_metadata() {- - post_content, 'attachment_content', $editor_args ); ?> -
- -