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:

functions.php
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.

  1. CMB2 icon CMB2300,000+ installs apply_filters( 'cmb2_rest_enforce_options_page_read_permissions', false, $cmb ) includes/rest-api/CMB2_REST.php:970
  2. GamiPress icon GamiPress10,000+ installs apply_filters( 'cmb2_rest_enforce_options_page_read_permissions', false, $cmb ) libraries/cmb2/includes/rest-api/CMB2_REST.php:970
  3. AutomatorWP icon AutomatorWP6,000+ installs apply_filters( 'cmb2_rest_enforce_options_page_read_permissions', false, $cmb ) libraries/cmb2/includes/rest-api/CMB2_REST.php:970
  4. CommonsBooking icon CommonsBooking200+ installs apply_filters( 'cmb2_rest_enforce_options_page_read_permissions', false, $cmb ) vendor-prefixed/cmb2/cmb2/includes/rest-api/CMB2_REST.php:970
  5. ShortLinks Pro icon ShortLinks Pro100+ installs apply_filters( 'cmb2_rest_enforce_options_page_read_permissions', false, $cmb ) libraries/cmb2/includes/rest-api/CMB2_REST.php:970
  6. BBForms icon BBForms20+ installs apply_filters( 'cmb2_rest_enforce_options_page_read_permissions', false, $cmb ) libraries/cmb2/includes/rest-api/CMB2_REST.php:970
  7. WhatAvatar icon 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.