Action hook 'load-widgets.php'

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

View Source

load-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 1717

Hook Parameters

This hook doesn't accept any parameters.

Usage Examples

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

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

Source Code Context

wp-includes/class-wp-customize-widgets.php:1717 - How this hook is used in WordPress core
<?php
1712  		if ( empty( $_POST['widget-id'] ) ) {
1713  			wp_send_json_error( 'missing_widget-id' );
1714  		}
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 */

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.