/user_capability

DescriptionDescription

This filter is called everytime an action verifies the user role/capability. User role/capability check is done in order to authorize certain users to access and act on plugin data (like editing/deleting/importing).

ArgumentsArguments

ArgumentTypeDescription
$capabilitystringDefault user capability manage_options

ExampleExample

PHP
functions.php
function prefix_set_user_capability( $capability ) {

	// Allow Editors to manage the plugin.
	if ( current_user_can( 'editor' ) ) {
		$capability = 'editor';
	}

	return $capability;

}

add_filter( 'wp_grid_builder/user_capability', 'prefix_set_user_capability', 10, 1 );