[wp-trac] [WordPress Trac] #53801: Block-based Widgets Screen does action wp_footer after each Widget

WordPress Trac noreply at wordpress.org
Thu Aug 26 09:19:59 UTC 2021


#53801: Block-based Widgets Screen does action wp_footer after each Widget
--------------------------+---------------------
 Reporter:  MadtownLems   |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  5.8.1
Component:  Widgets       |     Version:  5.8
 Severity:  major         |  Resolution:
 Keywords:  has-patch     |     Focuses:
--------------------------+---------------------

Comment (by costdev):

 Actually, my comment above on the PR will still result in the email opt-in
 case that @eatingrules raised. I'm not sure that type of case is
 resolvable via Core and would likely need plugin/theme developer action -
 a situation we're trying to avoid since we're specifically dealing with
 ''Legacy'' widgets.

 The proposed solution by @eatingrules to remove previews for legacy
 widgets might be the best option for now.

 To quickly see what this will look like in your own installs:

 1. Go to Appearance > Widgets.
 2. Open DevTools (F12).
 3. In the console, paste the following and press enter:


 {{{
 const legacy = document.querySelectorAll( '.wp-block-legacy-widget' );

 legacy.forEach( ( widget ) => {
     const form    = widget.querySelector( '.wp-block-legacy-widget__edit-
 form' ),
           preview = widget.querySelector( '.wp-block-legacy-widget__edit-
 preview' );

     form.removeAttribute( 'hidden' );
     preview.style.display = 'none';
 });
 }}}

 **Note:** Don't hook the code above into a production site - clicking on
 and off a legacy widget will return to the preview. The code above is for
 a visual example of legacy widget rendering as per @eatingrules proposed
 solution.

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


More information about the wp-trac mailing list