WordPress.org

Make WordPress Core

Changeset 49560


Ignore:
Timestamp:
11/10/2020 08:38:59 PM (13 months ago)
Author:
helen
Message:

Widgets: Do not use wrapping container in the admin.

This is due to the new before|after_sidebar args, which are empty by default, but can introduce markup that causes admin JS to stop working.

Also adds documentation for the sprintf() on before_sidebar.

Props audrasjb, lpointet.
See #19709.

File:
1 edited

Legend:

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

    r49203 r49560  
    244244 *                                  Default is a closing h2 element.
    245245 *     @type string $before_sidebar HTML content to prepend to the sidebar when displayed.
     246 *                                  Receives the '$id' argument as %1$s and '$class' as %2$s.
    246247 *                                  Outputs after the {@see 'dynamic_sidebar_before'} action.
    247248 *                                  Default empty string.
     
    719720    do_action( 'dynamic_sidebar_before', $index, true );
    720721
    721     if ( ! empty( $sidebar['before_sidebar'] ) ) {
     722    if ( ! is_admin() && ! empty( $sidebar['before_sidebar'] ) ) {
    722723        echo $sidebar['before_sidebar'];
    723724    }
     
    824825    }
    825826
    826     if ( ! empty( $sidebar['after_sidebar'] ) ) {
     827    if ( ! is_admin() && ! empty( $sidebar['after_sidebar'] ) ) {
    827828        echo $sidebar['after_sidebar'];
    828829    }
Note: See TracChangeset for help on using the changeset viewer.