Documentation

apply_filters("whereused_user_access_capability", string $capability)

Details

  • whereused_user_access_capability
  • filter hook
  • Active
  • 1.1.0

Description

By default, all users must have the capability “edit_pages” to have access the the admin pages of WhereUsed. If you want to change the minimum required capability, you can use this hook to modify that.

Parameters

$capability string
Rquired user capability

Example Code:

/**
 * Require that only admins have access to WhereUsed
 * 
 * @link https://whereused.com/docs/hooks/whereused_user_access_capability/
 * @return string
 */ 
function custom_wheregoes_access_capability(): string {

	// Require that only admins can have access to this plugin
	return 'manage_options';

}

add_filter('whereused_user_access_capability', 'custom_wheregoes_access_capability', 10, 0);

Filter context within the plugin’s code:

/**
 * This is the capability needed so that a user can be an option to have access to the tool and settings
 *
 * @package WhereUsed
 * @since   1.0.0
 * @link https://whereused.com/docs/hooks/whereused_user_access_capability/
 *
 * @return string
 */
public static function get_user_access_capability(): string {

	return apply_filters( 'whereused_user_access_capability', 'edit_pages' );

}

If you notice any incorrect or missing information on this page, please let us know.