Make WordPress Core

Changeset 47935


Ignore:
Timestamp:
06/09/2020 03:29:57 PM (5 years ago)
Author:
SergeyBiryukov
Message:

Docs: Improve documentation for is_active_sidebar().

The function determines whether the sidebar contains widgets, not that it is loaded on the page.

Props SUM1.
Fixes #50347.

File:
1 edited

Legend:

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

    r47122 r47935  
    901901 * @global array $wp_registered_sidebars Registered sidebars.
    902902 *
    903  * @return bool True, if using widgets. False, if not using widgets.
     903 * @return bool True if using widgets, false otherwise.
    904904 */
    905905function is_dynamic_sidebar() {
    906906    global $wp_registered_widgets, $wp_registered_sidebars;
     907
    907908    $sidebars_widgets = get_option( 'sidebars_widgets' );
     909
    908910    foreach ( (array) $wp_registered_sidebars as $index => $sidebar ) {
    909911        if ( ! empty( $sidebars_widgets[ $index ] ) ) {
     
    915917        }
    916918    }
     919
    917920    return false;
    918921}
    919922
    920923/**
    921  * Determines whether a sidebar is in use.
     924 * Determines whether a sidebar contains widgets.
    922925 *
    923926 * For more information on this and similar theme functions, check out
     
    928931 *
    929932 * @param string|int $index Sidebar name, id or number to check.
    930  * @return bool true if the sidebar is in use, false otherwise.
     933 * @return bool True if the sidebar has widgets, false otherwise.
    931934 */
    932935function is_active_sidebar( $index ) {
Note: See TracChangeset for help on using the changeset viewer.