Ticket #37245: 37245.diff
File 37245.diff, 1.8 KB (added by , 5 years ago) |
---|
-
wp-includes/option.php
2114 2114 * } 2115 2115 */ 2116 2116 function register_setting( $option_group, $option_name, $args = array() ) { 2117 2117 2118 global $new_whitelist_options, $wp_registered_settings; 2118 2119 2119 2120 $defaults = array( … … 2186 2187 if ( array_key_exists( 'default', $args ) ) { 2187 2188 add_filter( "default_option_{$option_name}", 'filter_default_option', 10, 3 ); 2188 2189 } 2189 2190 2191 /** 2192 * Fires immediately before setting arguments are added but after filters are in place. 2193 * 2194 * @param string $option_name Name of the option. 2195 * @param string $option_group Option group name. 2196 * @param array $args Array of settings arguments. 2197 */ 2198 do_action( 'register_setting', $option_name, $option_group, $args ); 2199 2190 2200 $wp_registered_settings[ $option_name ] = $args; 2191 2201 } 2192 2202 … … 2251 2261 } 2252 2262 2253 2263 if ( isset( $wp_registered_settings[ $option_name ] ) ) { 2264 2254 2265 // Remove the sanitize callback if one was set during registration. 2255 2266 if ( ! empty( $wp_registered_settings[ $option_name ]['sanitize_callback'] ) ) { 2256 2267 remove_filter( "sanitize_option_{$option_name}", $wp_registered_settings[ $option_name ]['sanitize_callback'] ); … … 2260 2271 if ( array_key_exists( 'default', $wp_registered_settings[ $option_name ] ) ) { 2261 2272 remove_filter( "default_option_{$option_name}", 'filter_default_option', 10 ); 2262 2273 } 2263 2274 2275 /** 2276 * Fires immediately before unsetting a specific settings and after filters have been removed. 2277 * 2278 * @param string $option_name Name of the option. 2279 * @param string $option_group Option group name. 2280 */ 2281 do_action( 'unregister_setting', $option_name, $option_group ); 2282 2264 2283 unset( $wp_registered_settings[ $option_name ] ); 2265 2284 } 2266 2285 }