Commit 50f0fee3ba for wordpress.org
commit 50f0fee3ba16506ba690d2f85e83951a6b540a5c
Author: westonruter <westonruter@git.wordpress.org>
Date: Tue Oct 20 23:56:52 2026 +0000
Docs: Allow a callable `$args` in `register_setting()`.
For backward compatibility, `register_setting()` still accepts a sanitize callback as its third argument, converting it into the `sanitize_callback` argument without a deprecation notice. Its docblock documented `$args` only as an array, so once PHPStan began reading the hash notation in r63420, callers passing a callback were reported, such as Twenty Eleven and the deprecated `add_option_update_handler()`. This form remains in wide use across thousands of plugins and themes in the theme & plugin directories.
Developed in https://github.com/WordPress/wordpress-develop/pull/14137.
Follow-up to r38635, r63420.
Props jorgefilipecosta, westonruter.
See #65817, #65860.
Built from https://develop.svn.wordpress.org/trunk@64670
git-svn-id: http://core.svn.wordpress.org/trunk@63820 1a063a9b-81f0-0310-95a4-ce76da25c4cd
diff --git a/wp-includes/option.php b/wp-includes/option.php
index 8bb89b7ceb..1d6962a546 100644
--- a/wp-includes/option.php
+++ b/wp-includes/option.php
@@ -3047,12 +3047,13 @@ function _wp_register_initial_settings_for_abilities(): void {
* @global array $new_allowed_options
* @global array $wp_registered_settings
*
- * @param string $option_group A settings group name. Should correspond to an allowed option key name.
- * Default allowed option key names include 'general', 'discussion', 'media',
- * 'reading', 'writing', and 'options'.
- * @param string $option_name The name of an option to sanitize and save.
- * @param array $args {
- * Data used to describe the setting when registered.
+ * @param string $option_group A settings group name. Should correspond to an allowed option key name.
+ * Default allowed option key names include 'general', 'discussion', 'media',
+ * 'reading', 'writing', and 'options'.
+ * @param string $option_name The name of an option to sanitize and save.
+ * @param array|callable $args {
+ * Data used to describe the setting when registered. For backward compatibility, a callable
+ * may be passed instead, which is used as the `$sanitize_callback`.
*
* @type string $type The type of data associated with this setting.
* Valid values are 'string', 'boolean', 'integer', 'number', 'array',
diff --git a/wp-includes/version.php b/wp-includes/version.php
index b7e3fd7e50..123aa1b84f 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '7.2-beta1-64669';
+$wp_version = '7.2-beta1-64670';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.