WordPress filter hook
cmb2_rest_enforce_options_page_read_permissions
Defined by CMB2 and fired by 7 plugins in total, running on 316K+ sites between them.
“Whether to align options-page box REST reads with WordPress core's settings/options convention (reads gated behind a capability).”
How to use cmb2_rest_enforce_options_page_read_permissions
It's a filter: your callback receives the value and 1 more argument, and must return the (changed) value.
Add this to your theme's functions.php or a small custom plugin:
add_filter( 'cmb2_rest_enforce_options_page_read_permissions', function( $value, $cmb ) {
// Change $value here.
return $value;
}, 10, 2 );Argument names come from CMB2's source. Other plugins may pass different values: check the call in the plugin you're targeting below.
7 plugins that fire cmb2_rest_enforce_options_page_read_permissions
Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.
-
CMB2300,000+ installs
apply_filters( 'cmb2_rest_enforce_options_page_read_permissions', false, $cmb )includes/rest-api/CMB2_REST.php:970 -
GamiPress10,000+ installs
apply_filters( 'cmb2_rest_enforce_options_page_read_permissions', false, $cmb )libraries/cmb2/includes/rest-api/CMB2_REST.php:970 -
AutomatorWP6,000+ installs
apply_filters( 'cmb2_rest_enforce_options_page_read_permissions', false, $cmb )libraries/cmb2/includes/rest-api/CMB2_REST.php:970 -
CommonsBooking200+ installs
apply_filters( 'cmb2_rest_enforce_options_page_read_permissions', false, $cmb )vendor-prefixed/cmb2/cmb2/includes/rest-api/CMB2_REST.php:970 -
ShortLinks Pro100+ installs
apply_filters( 'cmb2_rest_enforce_options_page_read_permissions', false, $cmb )libraries/cmb2/includes/rest-api/CMB2_REST.php:970 -
BBForms20+ installs
apply_filters( 'cmb2_rest_enforce_options_page_read_permissions', false, $cmb )libraries/cmb2/includes/rest-api/CMB2_REST.php:970 -
WhatAvatar10+ installs
apply_filters( 'cmb2_rest_enforce_options_page_read_permissions', false, $cmb )libraries/cmb2/includes/rest-api/CMB2_REST.php:970
Need a customisation built on this hook?
Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.