roles as $role) { $cap_list = $role['capabilities']; foreach ($cap_list as $key => $cap) { //remove level_ from List if (substr($key, 0, 6) != 'level_') { $all_caps[$key] = 1; } } } ksort($all_caps); $read_cap = WP_STATISTICS\Option::get('read_capability', 'manage_options'); $option_list = ''; foreach ($all_caps as $key => $cap) { if ($key == $read_cap) { $selected = " SELECTED"; } else { $selected = ""; } $disabled = ''; if (!User::checkUserCapability($key)) { $disabled = 'disabled'; } $option_list .= sprintf( '', esc_attr($key), $selected, esc_attr($disabled), esc_attr($key) ); } ?> $cap) { if ($key == $manage_cap) { $selected = " SELECTED"; } else { $selected = ""; } $disabled = ''; if (!User::checkUserCapability($key)) { $disabled = 'disabled'; } $option_list .= sprintf( '', esc_attr($key), $selected, esc_attr($disabled), esc_attr($key) ); } ?>

WordPress Roles and Capabilities page.', 'wp-statistics'), 'https://wordpress.org/support/article/roles-and-capabilities/'); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>

Hints on Capabilities:', 'wp-statistics'); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>

  • manage_network corresponds to the Super Admin role in a network setup.
  • manage_options is typically an Administrator capability.
  • edit_others_posts is usually associated with the Editor role.
  • publish_posts is a capability given to Authors.
  • ... and so on. Remember, capabilities define what a user role can do, and roles are a collection of these capabilities.
  • ', 'wp-statistics') // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>

    Capability Manager Enhanced plugin for a robust solution.', 'wp-statistics'), 'https://wordpress.org/plugins/capability-manager-enhanced/'); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>

    "var wpsCurrentTab = getElementById('wps_current_tab'); wpsCurrentTab.value='access-settings'")); ?>