WordPress.org

Make WordPress Core

Ticket #19709: 19709.3.diff

File 19709.3.diff, 680 bytes (added by audrasjb, 13 months ago)

Display before_sidebar and after_sidebar only on front-end

  • src/wp-includes/widgets.php

    diff --git a/src/wp-includes/widgets.php b/src/wp-includes/widgets.php
    index a7f54d697b..e293760673 100644
    a b function dynamic_sidebar( $index = 1 ) { 
    718718         */
    719719        do_action( 'dynamic_sidebar_before', $index, true );
    720720
    721         if ( ! empty( $sidebar['before_sidebar'] ) ) {
     721        if ( ! is_admin() && ! empty( $sidebar['before_sidebar'] ) ) {
    722722                echo $sidebar['before_sidebar'];
    723723        }
    724724
    function dynamic_sidebar( $index = 1 ) { 
    823823                }
    824824        }
    825825
    826         if ( ! empty( $sidebar['after_sidebar'] ) ) {
     826        if ( ! is_admin() && ! empty( $sidebar['after_sidebar'] ) ) {
    827827                echo $sidebar['after_sidebar'];
    828828        }
    829829