wppaste
WordPress

apply_filters( "option_page_capability_{$option_page}", string $capability )

Since
3.2.0
Filters the capability required when using the Settings API.

Description

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.

Compatibility

WordPress
since 3.2.0
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0).

Parameters

$capabilitystring
The capability used for the page, which is manage_options by default.

Where this hook fires · 1

  • wp-admin/options.php:46file scope

Source code

	 * 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 );} if ( ! current_user_can( $capability ) ) {	wp_die(		'<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .		'<p>' . __( 'Sorry, you are not allowed to manage options for this site.' ) . '</p>',

Changelog

Introduced in 3.2.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 6.7.7 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.