Make WordPress Core

Changeset 51842


Ignore:
Timestamp:
09/21/2021 10:12:18 PM (21 months ago)
Author:
azaozz
Message:

Update and enhance the docs for retrieve_widgets().

Props zieladam, hellofromtonya.
Fixes #53811.

File:
1 edited

Legend:

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

    r51791 r51842  
    12561256
    12571257/**
    1258  * Look for "lost" widgets, this has to run at least on each theme change.
     1258 * Validates and remaps any "orphaned" widgets to wp_inactive_sidgets sidebar, and saves the widget settings.
     1259 * This has to run at least on each theme change.
     1260 *
     1261 * For example, let's say theme A has a "footer" sidebar, and theme B doesn't have one.
     1262 * After switching from theme A to theme B, all the widgets previously assigned to the footer would be inaccessible.
     1263 * This function detects this scenario, and moves all the widgets previously assigned to the footer under wp_inactive_widgets.
     1264 *
     1265 * Despite the word "retrieve" in the name, this function actually updates the database and the global $sidebars_widgets.
     1266 * For that reason it should not be run from the front end unless the param value is 'customize' (to bypass the database write).
    12591267 *
    12601268 * @since 2.8.0
     
    13111319
    13121320    if ( 'customize' !== $theme_changed ) {
     1321        // Update the widgets settings in the database.
    13131322        wp_set_sidebars_widgets( $sidebars_widgets );
    13141323    }
Note: See TracChangeset for help on using the changeset viewer.