diff --git a/wp-admin/css/wp-admin-rtl.css b/wp-admin/css/wp-admin-rtl.css index a85a288560..f0977325c1 100644 --- a/wp-admin/css/wp-admin-rtl.css +++ b/wp-admin/css/wp-admin-rtl.css @@ -922,6 +922,11 @@ th.sorted a span { padding-right: 18px; } +.compat-attachment-fields th { + padding-right: 0; + padding-left: 10px; +} + /*------------------------------------------------------------------------------ 11.1 - Custom Fields ------------------------------------------------------------------------------*/ diff --git a/wp-admin/css/wp-admin.css b/wp-admin/css/wp-admin.css index ffb344fffb..556c8324f5 100644 --- a/wp-admin/css/wp-admin.css +++ b/wp-admin/css/wp-admin.css @@ -3400,6 +3400,11 @@ td.plugin-title p { display: none; } +.compat-attachment-fields th { + padding-top: 5px; + padding-right: 10px; +} + /*------------------------------------------------------------------------------ 11.2 - Post Revisions ------------------------------------------------------------------------------*/ diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php index 6cc1b63693..65034fa7a4 100644 --- a/wp-admin/includes/media.php +++ b/wp-admin/includes/media.php @@ -1276,6 +1276,7 @@ function get_compat_media_markup( $attachment_id, $args = null ) { $default_args = array( 'errors' => null, + 'taxonomies' => false, ); $args = wp_parse_args( $args, $default_args ); @@ -1283,26 +1284,28 @@ function get_compat_media_markup( $attachment_id, $args = null ) { $form_fields = array(); - foreach ( get_attachment_taxonomies($post) as $taxonomy ) { - $t = (array) get_taxonomy($taxonomy); - if ( ! $t['public'] || ! $t['show_ui'] ) - continue; - if ( empty($t['label']) ) - $t['label'] = $taxonomy; - if ( empty($t['args']) ) - $t['args'] = array(); + if ( $args['taxonomies'] ) { + foreach ( get_attachment_taxonomies($post) as $taxonomy ) { + $t = (array) get_taxonomy($taxonomy); + if ( ! $t['public'] || ! $t['show_ui'] ) + continue; + if ( empty($t['label']) ) + $t['label'] = $taxonomy; + if ( empty($t['args']) ) + $t['args'] = array(); - $terms = get_object_term_cache($post->ID, $taxonomy); - if ( false === $terms ) - $terms = wp_get_object_terms($post->ID, $taxonomy, $t['args']); + $terms = get_object_term_cache($post->ID, $taxonomy); + if ( false === $terms ) + $terms = wp_get_object_terms($post->ID, $taxonomy, $t['args']); - $values = array(); + $values = array(); - foreach ( $terms as $term ) - $values[] = $term->slug; - $t['value'] = join(', ', $values); + foreach ( $terms as $term ) + $values[] = $term->slug; + $t['value'] = join(', ', $values); - $form_fields[$taxonomy] = $t; + $form_fields[$taxonomy] = $t; + } } // Merge default fields with their errors, so any key passed with the error (e.g. 'error', 'helps', 'value') will replace the default @@ -1332,6 +1335,7 @@ function get_compat_media_markup( $attachment_id, $args = null ) { continue; $name = "attachments[$attachment_id][$id]"; + $id_attr = "attachments-$attachment_id-$id"; if ( !empty( $field['tr'] ) ) { $item .= $field['tr']; @@ -1341,17 +1345,17 @@ function get_compat_media_markup( $attachment_id, $args = null ) { $field = array_merge( $defaults, $field ); if ( $field['input'] == 'hidden' ) { - $hidden_fields[$id] = $field['value']; + $hidden_fields[$name] = $field['value']; continue; } $required = $field['required'] ? '*' : ''; $aria_required = $field['required'] ? " aria-required='true' " : ''; - $class = 'compat-item-' . $name; + $class = 'compat-field-' . $id; $class .= $field['required'] ? ' form-required' : ''; $item .= "\t\t
" . join( "
\n", array_unique( (array) $field['helps'] ) ) . '
'; @@ -1388,7 +1392,7 @@ function get_compat_media_markup( $attachment_id, $args = null ) { if ( !empty( $form_fields['_final'] ) ) $item .= "\t\t