diff --git a/wp-admin/options.php b/wp-admin/options.php index 1d60fc70ec..8db5cf50f2 100644 --- a/wp-admin/options.php +++ b/wp-admin/options.php @@ -31,21 +31,21 @@ $capability = 'manage_options'; // This is for back compat and will eventually be removed. if ( empty( $option_page ) ) { $option_page = 'options'; -} else { - - /** - * Filters the capability required when using the Settings API. - * - * By default, the options groups for all registered settings require the manage_options capability. - * This filter is required to change the capability required for a certain options page. - * - * @since 3.2.0 - * - * @param string $capability The capability used for the page, which is manage_options by default. - */ - $capability = apply_filters( "option_page_capability_{$option_page}", $capability ); } +/** + * Filters the capability required when using the Settings API. + * + * By default, the options groups for all registered settings require the manage_options capability. + * This filter is required to change the capability required for a certain options page. + * + * @since 3.2.0 + * @since 7.0.0 Applied when `wp-admin/options.php` is accessed directly. + * + * @param string $capability The capability used for the page, which is manage_options by default. + */ +$capability = apply_filters( "option_page_capability_{$option_page}", $capability ); + if ( ! current_user_can( $capability ) ) { wp_die( '