[wp-trac] [WordPress Trac] #40951: New Text Widget - Switching Between Visual/Text Editor Strips Out Code

WordPress Trac noreply at wordpress.org
Tue Jul 4 22:21:28 UTC 2017


#40951: New Text Widget - Switching Between Visual/Text Editor Strips Out Code
-------------------------------------------------+-------------------------
 Reporter:  dwrippe                              |       Owner:
     Type:  defect (bug)                         |  westonruter
 Priority:  normal                               |      Status:  accepted
Component:  Widgets                              |   Milestone:  4.8.1
 Severity:  major                                |     Version:  4.8
 Keywords:  needs-testing has-unit-tests has-    |  Resolution:
  patch                                          |     Focuses:
-------------------------------------------------+-------------------------

Comment (by westonruter):

 Replying to [comment:90 WPwebbouw]:
 > One issue may have been overlooked in this discussion. If the text
 widget is being replaced by a new HTML widget, then also the filter
 `widget_text` will be renamed. This means that any code in a theme or
 widget that uses this filter must be changed to use the new filter name.
 Which means this solution would again require admins to manually check all
 sites where text widgets have been applied to see if this filter has been
 used.

 The Text widget is not being replaced by the Custom HTML widget; it is
 being added alongside. For the Text widget, the `widget_text` filter
 remains on the Text widget. If the legacy mode is enabled, then this is
 the only filter that applies. If not in legacy mode, then that filter
 applies ''before'' the new `widget_text_content` filter. See
 https://github.com/WordPress/wordpress-develop/blob/4.8.0/src/wp-
 includes/widgets/class-wp-widget-text.php#L72-L98

 If there are filters you want to apply to the Custom HTML widget, then any
 such functions should also be added to the `widget_custom_html_content`
 filter as well. If a case can be made, the `widget_text` filter ''could''
 potentially be applied in the Custom HTML widget as well. For that,
 comment on #40907 with specific examples.

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


More information about the wp-trac mailing list