Overview

With this hook, you can determine which WordPress user role has access to the User Post Type add-on settings.

The hook lets you specify a user capability, which in turn determines the role. The default capability is set to manage_options, which is an Administrator capability.

Parameters

  • $capability | string | The capability that has access to the User Post Type settings. Default: manage_options.

Usage

This example shows how to give the Editor role access to User Post Type settings, by setting the $capability to edit_pages:

How to use custom PHP code?

PHP code can be added to your (child) theme's functions.php file. Alternatively, you can use the Custom Hooks add-on, or a code snippets plugin. More info

add_filter( 'upt_admin_settings_capability', function( $capability ) { return 'edit_pages'; // Give Editors access to the User Post Type settings pages. Default: 'manage_options'. }, 10, 1 );

See also

Last updated: December 17, 2024