Description

Filters user access to WPForms based on their current role’s capabilities.

Parameters

$cap
(type) (Required) Capability required for user role to access WPForms.

Source

wpforms/includes/functions.php

More Information

The wpforms_manage_cap filter is applied to any user who logs into the WordPress dashboard. By default, only users with the manage_options capability (administrator role) will have access to WPForms.

Examples

/**
 * Filters user access to WPForms based on their current role’s capabilities.
 *
 * @link   https://wpforms.com/developers/wpforms_manage_cap/
 *
 * @param  string $cap
 * @return type
 */
function wpf_dev_manage_cap( $cap ) {
 
    // unfiltered_html by default means Editors and up.
    // See more about WordPress roles and capabilities
    // https://codex.wordpress.org/Roles_and_Capabilities
    return 'unfiltered_html';
}
add_filter( 'wpforms_manage_cap', 'wpf_dev_manage_cap' );

For a snippet to expand WPForms access to Editor roles, please see our tutorial.