[wp-trac] [WordPress Trac] #31698: Fields added via `attachment_fields_to_edit` filter not included in "Image Details" UI
WordPress Trac
noreply at wordpress.org
Thu Mar 19 20:35:11 UTC 2015
#31698: Fields added via `attachment_fields_to_edit` filter not included in "Image
Details" UI
-----------------------------+----------------------------
Reporter: danielbachhuber | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Future Release
Component: Media | Version:
Severity: normal | Keywords: needs-patch
Focuses: |
-----------------------------+----------------------------
I can add a field to the Attachment Details UI via the
`attachment_fields_to_edit` filter:
{{{
add_filter( 'attachment_fields_to_edit', function( $fields, $post ){
$metadata = wp_get_attachment_metadata( $post->ID );
if ( ! empty( $metadata['image_meta'] ) ) {
$fields['fusion_credit'] = array(
'label' => esc_html__( 'Credit',
'fusion' ),
'input' => 'text',
'value' =>
$metadata['image_meta']['credit'],
);
}
return $fields;
}, 10, 2 );
}}}
I'd expect this field would be appear in "Image Details" too, but it
doesn't (ignore the credit in the caption field):
[[Image(https://dl.dropboxusercontent.com/s/zhizhxmpb7a27uf/2015-03-19%20at%201.33%20PM%20%281%29.png?dl=0)]]
--
Ticket URL: <https://core.trac.wordpress.org/ticket/31698>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list