[wp-trac] [WordPress Trac] #55563: The function get_allowed_mime_types should check wp_get_current_user

WordPress Trac noreply at wordpress.org
Thu Apr 9 05:07:49 UTC 2026


#55563: The function get_allowed_mime_types should check wp_get_current_user
------------------------------------+------------------------------
 Reporter:  giuse                   |       Owner:  (none)
     Type:  defect (bug)            |      Status:  new
 Priority:  normal                  |   Milestone:  Awaiting Review
Component:  Formatting              |     Version:  5.9.3
 Severity:  normal                  |  Resolution:
 Keywords:  dev-feedback has-patch  |     Focuses:
------------------------------------+------------------------------
Changes (by bruheshwarinikhil):

 * keywords:  dev-feedback has-patch has-unit-tests => dev-feedback has-
               patch


Comment:

 Fixes a fatal error when get_allowed_mime_types() is called before
 wp_get_current_user() is defined (e.g. in a mu-plugin or before the
 plugin_loaded action). Fixes #55563.

 Adds function_exists( 'wp_get_current_user' ) check alongside the existing
 current_user_can check so the function degrades safely when the user
 system isn't loaded yet.

 **PR Link => https://github.com/WordPress/wordpress-develop/pull/11482**

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


More information about the wp-trac mailing list