Overview

With this hook, you can determine which WordPress user role has access to the FacetWP settings. This makes it possible to let for example Editors use facets and listings.

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.

The hook is applied to the main FacetWP plugin, and these add-ons:

Parameters

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

Usage

This example shows how to give the Editor role access to FacetWP 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( 'facetwp_admin_settings_capability', function( $capability ) { return 'edit_pages'; // Give Editors access to the FacetWP settings pages. Default: 'manage_options'. }, 10, 1 );

See also

Last updated: December 17, 2024