Administration: Include options page name in the "Options page not found" error message to provide better context for plugin developers.

Props tdlewis77, williampatton.
Fixes #42941.
Built from https://develop.svn.wordpress.org/trunk@47158


git-svn-id: http://core.svn.wordpress.org/trunk@46958 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2020-02-01 22:42:06 +00:00
parent 8e37999368
commit a0f8b7003b
2 changed files with 10 additions and 4 deletions

View File

@ -200,7 +200,7 @@ if ( ! is_multisite() ) {
* *
* @since 2.7.0 * @since 2.7.0
* *
* @param array $whitelist_options Whitelist options. * @param array $whitelist_options The options whitelist.
*/ */
$whitelist_options = apply_filters( 'whitelist_options', $whitelist_options ); $whitelist_options = apply_filters( 'whitelist_options', $whitelist_options );
@ -217,7 +217,13 @@ if ( 'update' == $action ) {
} }
if ( ! isset( $whitelist_options[ $option_page ] ) ) { if ( ! isset( $whitelist_options[ $option_page ] ) ) {
wp_die( __( '<strong>Error</strong>: Options page not found.' ) ); wp_die(
sprintf(
/* translators: %s: The options page name. */
__( '<strong>Error</strong>: Options page %s not found in the options whitelist.' ),
'<code>' . esc_html( $option_page ) . '</code>'
)
);
} }
if ( 'options' == $option_page ) { if ( 'options' == $option_page ) {
@ -268,7 +274,7 @@ if ( 'update' == $action ) {
sprintf( sprintf(
/* translators: %s: The option/setting. */ /* translators: %s: The option/setting. */
__( 'The %s setting is unregistered. Unregistered settings are deprecated. See https://developer.wordpress.org/plugins/settings/settings-api/' ), __( 'The %s setting is unregistered. Unregistered settings are deprecated. See https://developer.wordpress.org/plugins/settings/settings-api/' ),
'<code>' . $option . '</code>' '<code>' . esc_html( $option ) . '</code>'
) )
); );
} }

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.4-alpha-47157'; $wp_version = '5.4-alpha-47158';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.