[wp-trac] [WordPress Trac] #42063: Media: Indicate if image is used as a site option
WordPress Trac
noreply at wordpress.org
Mon Nov 16 18:09:01 UTC 2020
#42063: Media: Indicate if image is used as a site option
----------------------------------------------+----------------------------
Reporter: melchoyce | Owner: helen
Type: enhancement | Status: closed
Priority: normal | Milestone: 5.6
Component: Media | Version:
Severity: normal | Resolution: fixed
Keywords: has-patch has-screenshots commit | Focuses: ui,
| administration
----------------------------------------------+----------------------------
Comment (by smithjw1):
Replying to [comment:31 emrikol]:
> It looks like this will cause a PHP fatal if
`wp_prepare_attachment_for_js()` is called early in a theme file.
A possible solution would be to wrap the call in a conditional:
{{{#!php
<?php
if ( function_exists( 'get_media_states' ) ) {
$media_states = get_media_states( $attachment );
if ( ! empty( $media_states ) ) {
$response['mediaStates'] = implode( ', ', $media_states );
}
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/42063#comment:32>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list