: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
'widget_id' => $widget_id,
'widget_name' => $wp_registered_widgets[ $widget_id ]['name'],
(array) $wp_registered_widgets[ $widget_id ]['params']
// Substitute HTML `id` and `class` attributes into `before_widget`.
foreach ( (array) $wp_registered_widgets[ $widget_id ]['classname'] as $cn ) {
if ( is_string( $cn ) ) {
$classname_ .= '_' . $cn;
} elseif ( is_object( $cn ) ) {
$classname_ .= '_' . get_class( $cn );
$classname_ = ltrim( $classname_, '_' );
$params[0]['before_widget'] = sprintf( $params[0]['before_widget'], $widget_id, $classname_ );
/** This filter is documented in wp-includes/widgets.php */
$params = apply_filters( 'dynamic_sidebar_params', $params );
$callback = $wp_registered_widgets[ $widget_id ]['callback'];
/** This filter is documented in wp-includes/widgets.php */
do_action( 'dynamic_sidebar', $wp_registered_widgets[ $widget_id ] );
if ( is_callable( $callback ) ) {
call_user_func_array( $callback, $params );
* Calls the control callback of a widget and returns the output.
* @global array $wp_registered_widget_controls The registered widget controls.
* @param string $id Widget ID.
function wp_render_widget_control( $id ) {
global $wp_registered_widget_controls;
if ( ! isset( $wp_registered_widget_controls[ $id ]['callback'] ) ) {
$callback = $wp_registered_widget_controls[ $id ]['callback'];
$params = $wp_registered_widget_controls[ $id ]['params'];
if ( is_callable( $callback ) ) {
call_user_func_array( $callback, $params );
* Displays a _doing_it_wrong() message for conflicting widget editor scripts.
* The 'wp-editor' script module is exposed as window.wp.editor. This overrides
* the legacy TinyMCE editor module which is required by the widgets editor.
* Because of that conflict, these two shouldn't be enqueued together.
* See https://core.trac.wordpress.org/ticket/53569.
* There is also another conflict related to styles where the block widgets
* editor is hidden if a block enqueues 'wp-edit-post' stylesheet.
* See https://core.trac.wordpress.org/ticket/53569.
* @global WP_Scripts $wp_scripts
* @global WP_Styles $wp_styles
function wp_check_widget_editor_deps() {
global $wp_scripts, $wp_styles;
$wp_scripts->query( 'wp-edit-widgets', 'enqueued' ) ||
$wp_scripts->query( 'wp-customize-widgets', 'enqueued' )
if ( $wp_scripts->query( 'wp-editor', 'enqueued' ) ) {
/* translators: 1: 'wp-editor', 2: 'wp-edit-widgets', 3: 'wp-customize-widgets'. */
__( '"%1$s" script should not be enqueued together with the new widgets editor (%2$s or %3$s).' ),
if ( $wp_styles->query( 'wp-edit-post', 'enqueued' ) ) {
/* translators: 1: 'wp-edit-post', 2: 'wp-edit-widgets', 3: 'wp-customize-widgets'. */
__( '"%1$s" style should not be enqueued together with the new widgets editor (%2$s or %3$s).' ),
* Registers the previous theme's sidebars for the block themes.
* @global array $wp_registered_sidebars The registered sidebars.
function _wp_block_theme_register_classic_sidebars() {
global $wp_registered_sidebars;
if ( ! wp_is_block_theme() ) {
$classic_sidebars = get_theme_mod( 'wp_classic_sidebars' );
if ( empty( $classic_sidebars ) ) {
// Don't use `register_sidebar` since it will enable the `widgets` support for a theme.
foreach ( $classic_sidebars as $sidebar ) {
$wp_registered_sidebars[ $sidebar['id'] ] = $sidebar;