Make WordPress Core


Ignore:
Timestamp:
09/26/2022 10:41:11 PM (4 years ago)
Author:
davidbaumwald
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/widgets/class-wp-widget-text.php

    r54248 r54319  
    245245                /*
    246246                 * Suspend legacy plugin-supplied do_shortcode() for 'widget_text' filter for the visual Text widget to prevent
    247                  * shortcodes being processed twice. Now apply_shortcodes() is added to the 'widget_text_content' filter in core itself
     247                 * shortcodes being processed twice. Now do_shortcode() is added to the 'widget_text_content' filter in core itself
    248248                 * and it applies after wpautop() to prevent corrupting HTML output added by the shortcode. When do_shortcode() is
    249                  * added to 'widget_text_content' then apply_shortcodes() will be manually called when in legacy mode as well.
     249                 * added to 'widget_text_content' then do_shortcode() will be manually called when in legacy mode as well.
    250250                 */
    251251                $widget_text_do_shortcode_priority       = has_filter( 'widget_text', 'do_shortcode' );
     
    303303                        /*
    304304                         * Manually do shortcodes on the content when the core-added filter is present. It is added by default
    305                          * in core by adding apply_shortcodes() to the 'widget_text_content' filter to apply after wpautop().
     305                         * in core by adding do_shortcode() to the 'widget_text_content' filter to apply after wpautop().
    306306                         * Since the legacy Text widget runs wpautop() after 'widget_text' filters are applied, the widget in
    307                          * legacy mode here manually applies apply_shortcodes() on the content unless the default
     307                         * legacy mode here manually applies do_shortcode() on the content unless the default
    308308                         * core filter for 'widget_text_content' has been removed, or if do_shortcode() has already
    309309                         * been applied via a plugin adding do_shortcode() to 'widget_text' filters.
     
    313313                                        $text = shortcode_unautop( $text );
    314314                                }
    315                                 $text = apply_shortcodes( $text );
     315                                $text = do_shortcode( $text );
    316316                        }
    317317                }
Note: See TracChangeset for help on using the changeset viewer.