wp_unregister_sidebar_widget
Action HookDescription
Fires just before a widget is removed from a sidebar.Hook Information
| File Location |
wp-includes/widgets.php
View on GitHub
|
| Hook Type | Action |
| Line Number | 504 |
Hook Parameters
| Type | Name | Description |
|---|---|---|
int|string
|
$id
|
The widget ID. |
Usage Examples
Basic Usage
<?php
// Hook into wp_unregister_sidebar_widget
add_action('wp_unregister_sidebar_widget', 'my_custom_function', 10, 1);
function my_custom_function($id) {
// Your custom code here
}
Source Code Context
wp-includes/widgets.php:504
- How this hook is used in WordPress core
<?php
499 *
500 * @since 3.0.0
501 *
502 * @param int|string $id The widget ID.
503 */
504 do_action( 'wp_unregister_sidebar_widget', $id );
505
506 wp_register_sidebar_widget( $id, '', '' );
507 wp_unregister_widget_control( $id );
508 }
509
PHP Documentation
<?php
/**
* Fires just before a widget is removed from a sidebar.
*
* @since 3.0.0
*
* @param int|string $id The widget ID.
*/
Quick Info
- Hook Type: Action
- Parameters: 1
- File: wp-includes/widgets.php
Related Hooks
Related hooks will be displayed here in future updates.