[wp-trac] [WordPress Trac] #43125: Deregistering WP_Widget_Media_Image breaks Text widget's "Add Media" button

WordPress Trac noreply at wordpress.org
Thu Jan 18 15:19:57 UTC 2018


#43125: Deregistering WP_Widget_Media_Image breaks Text widget's "Add Media" button
---------------------------+-----------------------
 Reporter:  standardspace  |       Owner:
     Type:  defect (bug)   |      Status:  reopened
 Priority:  normal         |   Milestone:
Component:  Widgets        |     Version:  4.9.2
 Severity:  normal         |  Resolution:
 Keywords:                 |     Focuses:
---------------------------+-----------------------
Changes (by standardspace):

 * status:  closed => reopened
 * resolution:  invalid =>


Comment:

 I've investigated further and found that the "Add Media" button fails
 unless one of the Media widgets is active.

 Adding this to the Twenty Seventeen theme:

 {{{#!php
 <?php
 add_action( 'widgets_init', function() {
    unregister_widget( 'WP_Widget_Media_Image' );
    unregister_widget( 'WP_Widget_Media_Audio' );
    unregister_widget( 'WP_Widget_Media_Video' );
    unregister_widget( 'WP_Widget_Media_Gallery' );
 } );
 }}}

 causes the "Add Media" button to fail.

 Looks like the required javascript may not be loaded when there are no
 "media" widgets present. This leaves the Text widget without the add media
 functionality.

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


More information about the wp-trac mailing list