WordPress.org

Make WordPress Core

Ticket #51791: 51792.patch

File 51792.patch, 716 bytes (added by rebasaurus, 14 months ago)

Since I see that we check for the existence of get_compat_media_markup above, I think we can do the same behavior here?

  • src/wp-includes/media.php

    diff --git a/src/wp-includes/media.php b/src/wp-includes/media.php
    index 8b8b862e5d..3d8507ff90 100644
    a b function wp_prepare_attachment_for_js( $attachment ) { 
    40294029                $response['compat'] = get_compat_media_markup( $attachment->ID, array( 'in_modal' => true ) );
    40304030        }
    40314031
    4032         $media_states = get_media_states( $attachment );
    4033         if ( ! empty( $media_states ) ) {
    4034                 $response['mediaStates'] = implode( ', ', $media_states );
     4032        if ( function_exists( 'get_media_states' ) ) {
     4033                $media_states = get_media_states( $attachment );
     4034                if ( ! empty( $media_states ) ) {
     4035                        $response['mediaStates'] = implode( ', ', $media_states );
     4036                }
    40354037        }
    40364038
    40374039        /**