[wp-trac] [WordPress Trac] #51791: When wp_prepare_attachment_for_js() is called too early, a fatal occurs "Call to undefined function get_media_states()"

WordPress Trac noreply at wordpress.org
Mon Nov 16 19:19:07 UTC 2020


#51791: When wp_prepare_attachment_for_js() is called too early, a fatal occurs
"Call to undefined function get_media_states()"
------------------------------+---------------------
 Reporter:  rebasaurus        |       Owner:  helen
     Type:  defect (bug)      |      Status:  closed
 Priority:  normal            |   Milestone:  5.6
Component:  Media             |     Version:  trunk
 Severity:  major             |  Resolution:  fixed
 Keywords:  has-patch commit  |     Focuses:
------------------------------+---------------------
Changes (by helen):

 * owner:  (none) => helen
 * status:  new => closed
 * resolution:   => fixed


Comment:

 In [changeset:"49613" 49613]:
 {{{
 #!CommitTicketReference repository="" revision="49613"
 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.
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/51791#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list