mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Shortcodes: Revert recent apply_shortcodes and do_shortcode changes.
[54248] reversed the wrapping of `do_shortcode` and `apply_shortcodes` and updated all direct internal calls of `do_shortcode` to `apply_shortcodes` after [47004]. After further consideration, the long history of `do_shortcodes` should be favored over any subjective semantic improvements. This change reverts the remaining changes from #55883 not already reverted in [54278]. Follow-up to [47004], [54248], and [54278]. Props azaozz, jorbin. See #55883. git-svn-id: https://develop.svn.wordpress.org/trunk@54319 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -244,9 +244,9 @@ class WP_Widget_Text extends WP_Widget {
|
||||
|
||||
/*
|
||||
* Suspend legacy plugin-supplied do_shortcode() for 'widget_text' filter for the visual Text widget to prevent
|
||||
* shortcodes being processed twice. Now apply_shortcodes() is added to the 'widget_text_content' filter in core itself
|
||||
* shortcodes being processed twice. Now do_shortcode() is added to the 'widget_text_content' filter in core itself
|
||||
* and it applies after wpautop() to prevent corrupting HTML output added by the shortcode. When do_shortcode() is
|
||||
* added to 'widget_text_content' then apply_shortcodes() will be manually called when in legacy mode as well.
|
||||
* added to 'widget_text_content' then do_shortcode() will be manually called when in legacy mode as well.
|
||||
*/
|
||||
$widget_text_do_shortcode_priority = has_filter( 'widget_text', 'do_shortcode' );
|
||||
$should_suspend_legacy_shortcode_support = ( $is_visual_text_widget && false !== $widget_text_do_shortcode_priority );
|
||||
@@ -302,9 +302,9 @@ class WP_Widget_Text extends WP_Widget {
|
||||
|
||||
/*
|
||||
* Manually do shortcodes on the content when the core-added filter is present. It is added by default
|
||||
* in core by adding apply_shortcodes() to the 'widget_text_content' filter to apply after wpautop().
|
||||
* in core by adding do_shortcode() to the 'widget_text_content' filter to apply after wpautop().
|
||||
* Since the legacy Text widget runs wpautop() after 'widget_text' filters are applied, the widget in
|
||||
* legacy mode here manually applies apply_shortcodes() on the content unless the default
|
||||
* legacy mode here manually applies do_shortcode() on the content unless the default
|
||||
* core filter for 'widget_text_content' has been removed, or if do_shortcode() has already
|
||||
* been applied via a plugin adding do_shortcode() to 'widget_text' filters.
|
||||
*/
|
||||
@@ -312,7 +312,7 @@ class WP_Widget_Text extends WP_Widget {
|
||||
if ( ! empty( $instance['filter'] ) ) {
|
||||
$text = shortcode_unautop( $text );
|
||||
}
|
||||
$text = apply_shortcodes( $text );
|
||||
$text = do_shortcode( $text );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user