Permissions for Menu Page and Field
-
I’m having trouble getting menu fields to display to certain custom user roles. The permission that the user needs is permission_x. When I add ‘capability’ => ‘permission_x’ to the addSubMenuItem() array, the page becomes available to this custom role with permission_x. However, the page only has a title and a submit button – there are no fields. I tried adding ‘capability’ => ‘permission_x’ to the arrays in addSettingsFields() but this didn’t do the trick. How can I get these to show up?
Here’s the full array called in the load_options_page() function
$this->addSettingFields(
array (
‘field_id’ => ‘users’,
‘type’ => ‘checkbox’,
‘title’ => __( ‘Choices’, ‘plugin’ ),
‘description’ => __( ‘Choose one.’, ‘plugin’ ),
‘capability’ => ‘permission_x’,
‘label’ => array(
‘one’ => ‘One’
‘two’ => ‘Two’
)
),
);Thanks.
- The topic ‘Permissions for Menu Page and Field’ is closed to new replies.