Action hook 'widgets.php'

in WP Core File wp-includes/class-wp-customize-widgets.php at line 1720

View Source

widgets.php

Action Hook
Description
Updates widget settings asynchronously. Allows the Customizer to update a widget using its form, but return the new instance info via Ajax instead of saving it to the options table. Most code here copied from wp_ajax_save_widget().

Hook Information

File Location wp-includes/class-wp-customize-widgets.php View on GitHub
Hook Type Action
Line Number 1720

Hook Parameters

This hook doesn't accept any parameters.

Usage Examples

Basic Usage
<?php
// Hook into widgets.php
add_action('widgets.php', 'my_custom_function');

function my_custom_function() {
    // Your custom code here
}

Source Code Context

wp-includes/class-wp-customize-widgets.php:1720 - How this hook is used in WordPress core
<?php
1715  
1716  		/** This action is documented in wp-admin/includes/ajax-actions.php */
1717  		do_action( 'load-widgets.php' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
1718  
1719  		/** This action is documented in wp-admin/includes/ajax-actions.php */
1720  		do_action( 'widgets.php' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
1721  
1722  		/** This action is documented in wp-admin/widgets.php */
1723  		do_action( 'sidebar_admin_setup' );
1724  
1725  		$widget_id = $this->get_post_value( 'widget-id' );

PHP Documentation

<?php
/**
	 * Updates widget settings asynchronously.
	 *
	 * Allows the Customizer to update a widget using its form, but return the new
	 * instance info via Ajax instead of saving it to the options table.
	 *
	 * Most code here copied from wp_ajax_save_widget().
	 *
	 * @since 3.9.0
	 *
	 * @see wp_ajax_save_widget()
	 */
Quick Info
  • Hook Type: Action
  • Parameters: 0
  • File: wp-includes/class-wp-customize-widgets.php
Related Hooks

Related hooks will be displayed here in future updates.