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

WordPress Trac noreply at wordpress.org
Thu Aug 19 00:54:47 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 peterwilsoncc):

 I am not sure what the best solution here is.

 Some widgets will depend on assets included in `wp_head()` and
 `wp_footer()` for either styling or JavaScript needed for rendering the
 widget preview. For example the [https://jetpack.com/support/extra-
 sidebar-widgets/social-icons-widget/ Jetpack's social icons widget]
 alongside several other plugins with widgets in the most popular plugins.

 The problem stems from unrelated plugins resuming the front-end for the
 actions a historically that's been the case and outputting features there
 as a result, be it analytics code or something that is displayed.

 Some possible solutions are:

 * Remove the front-end actions and use new `wp_widget_preview_*` in their
 place -- this will require all themes to enqueue default styles especially
 for the widget previews
 * Leave them in place -- requiring plugins to check `is_admin()` when
 enqueueing/adding anything not needed for the widget preview

 Both of these seem like bad choices, so I welcome any other suggestions.

 As I said, I'm not sure what the best solution is as either seem like a
 backward compatibility break but it's already been broken with using the
 formerly front-end only actions in the admin.

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

More information about the wp-trac mailing list