[wp-trac] [WordPress Trac] #46795: Fatal error: Call to undefined function get_available_post_mime_types on frontend

WordPress Trac noreply at wordpress.org
Thu Apr 4 12:23:19 UTC 2019


#46795: Fatal error: Call to undefined function get_available_post_mime_types on
frontend
--------------------------+-----------------------------
 Reporter:  david.binda   |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Hello there,

 When testing r44947 from #43658 I'm getting following fatal error:


 {{{
 Fatal error: Uncaught Error: Call to undefined function
 get_available_post_mime_types() in wp-includes/media.php:3612
 }}}

 The above fatal error can be reproduced using the P2 theme, since it
 includes `wp-includes/media.php` and calls `do_action( 'media_buttons' );`
 which calls `wp_enqueue_media` in a non-admin context / on front-end.

 Since the r44947 any call to `wp_enqueue_media` on front-end would result
 in the above fatal error.

 To solve the issue, the `get_available_post_mime_types` function, imho,
 needs to be moved to some more commonly available file, eg.: `wp-
 includes/post.php`.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/46795>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list