wp_unregister_sidebar_widget() WordPress Function

The wp_unregister_sidebar_widget() function allows you to unregister a sidebar widget. This function takes two parameters: the id of the sidebar widget to unregister, and an optional boolean value specifying whether to also unregister the sidebar widget from all registered sidebars. The default value for the second parameter is false.

wp_unregister_sidebar_widget( int|string $id ) #

Remove widget from sidebar.


Parameters

$id

(int|string)(Required)Widget ID.


Top ↑

Source

File: wp-includes/widgets.php

function wp_unregister_sidebar_widget( $id ) {

	/**
	 * Fires just before a widget is removed from a sidebar.
	 *
	 * @since 3.0.0
	 *
	 * @param int|string $id The widget ID.
	 */
	do_action( 'wp_unregister_sidebar_widget', $id );

	wp_register_sidebar_widget( $id, '', '' );
	wp_unregister_widget_control( $id );
}


Top ↑

Changelog

Changelog
VersionDescription
2.2.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.