Opens in a new tab
A picture of Jeff Brigman
I CODE TODAY FOR
A BETTER TOMORROW

Glossary Term

retrieve_widgets()

3 tags 1 category

retrieve_widgets() — Validates and remaps any “orphaned” widgets to wp_inactive_widgets sidebar, and saves the widget settings. This has to run at least on each theme change. For example, let’s say theme A has a “footer” sidebar, and theme B doesn’t have one. After switching from theme A to theme B, all the widgets previously assigned to the footer would be inaccessible. This function detects this scenario, and moves all the widgets previously assigned to the footer under wp_inactive_widgets. Despite the word “retrieve” in the name, this function actually updates the database and the global $sidebars_widgets.

Inputs: $theme_changed (string|bool): Whether the theme was changed as a boolean. A value of ‘customize’ defers updates for the Customizer.

Returns array: Updated sidebars widgets.

Term Connections

Explore related terms connected by shared tags, shared categories, and relationship phrases. This map loads only when it comes into view.

Loading term connections…