Make WordPress Core

Ticket #31675: 31675.4.diff

File 31675.4.diff, 1.1 KB (added by markjaquith, 9 years ago)
  • src/wp-includes/widgets.php

    diff --git src/wp-includes/widgets.php src/wp-includes/widgets.php
    index 5e3431f..5c266e8 100644
    function register_sidebar($args = array()) { 
    803803
    804804        $i = count($wp_registered_sidebars) + 1;
    805805
    806         if ( empty( $args['id'] ) ) {
    807                 /* translators: %s: the id argument */
    808                 _doing_it_wrong( __FUNCTION__, sprintf( __( 'You should set %s in the arguments array.' ), '<code>id</code>' ), '4.2.0' );
    809         }
     806        $id_is_empty = empty( $args['id'] );
    810807
    811808        $defaults = array(
    812809                'name' => sprintf(__('Sidebar %d'), $i ),
    function register_sidebar($args = array()) { 
    821818
    822819        $sidebar = wp_parse_args( $args, $defaults );
    823820
     821        if ( $id_is_empty ) {
     822                /* translators: %1$s: the id argument */
     823                _doing_it_wrong( __FUNCTION__, sprintf( __( 'No %1$s was set in the arguments array for the "%2$s" sidebar. Defaulting to "%3$s". Manually set the %1$s to  "%3$s" to silence this notice and keep existing sidebar area content.' ), '<code>id</code>', $sidebar['name'], $sidebar['id'] ), '4.2.0' );
     824        }
     825
    824826        $wp_registered_sidebars[$sidebar['id']] = $sidebar;
    825827
    826828        add_theme_support('widgets');