mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-02-26 10:42:59 +00:00
Media: Avoid fatal error in `wp_prepare_attachment_for_js().
In certain contexts, in particular on the front-end, `get_media_states()` is not availble. Props rebasaurus. Fixes #51791. git-svn-id: https://develop.svn.wordpress.org/trunk@49613 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
2c7b5c37db
commit
271702cd27
@ -4029,9 +4029,11 @@ function wp_prepare_attachment_for_js( $attachment ) {
|
||||
$response['compat'] = get_compat_media_markup( $attachment->ID, array( 'in_modal' => true ) );
|
||||
}
|
||||
|
||||
$media_states = get_media_states( $attachment );
|
||||
if ( ! empty( $media_states ) ) {
|
||||
$response['mediaStates'] = implode( ', ', $media_states );
|
||||
if ( function_exists( 'get_media_states' ) ) {
|
||||
$media_states = get_media_states( $attachment );
|
||||
if ( ! empty( $media_states ) ) {
|
||||
$response['mediaStates'] = implode( ', ', $media_states );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user