Changeset 60364 for trunk/src/wp-includes/capabilities.php
- Timestamp:
- 06/29/2025 09:45:30 PM (14 months ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/capabilities.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/capabilities.php
r60294 r60364 1097 1097 * Adds a role, if it does not exist. 1098 1098 * 1099 * The list of capabilities can be passed either as a numerically indexed array of capability names, or an 1100 * associative array of boolean values keyed by the capability name. To explicitly deny the role a capability, set 1101 * the value for that capability to false. 1102 * 1103 * Examples: 1104 * 1105 * // Add a role that can edit posts. 1106 * add_role( 'custom_role', 'Custom Role', array( 1107 * 'read', 1108 * 'edit_posts', 1109 * ) ); 1110 * 1111 * Or, using an associative array: 1112 * 1113 * // Add a role that can edit posts but explicitly cannot not delete them. 1114 * add_role( 'custom_role', 'Custom Role', array( 1115 * 'read' => true, 1116 * 'edit_posts' => true, 1117 * 'delete_posts' => false, 1118 * ) ); 1119 * 1099 1120 * @since 2.0.0 1100 * 1101 * @param string $role Role name. 1102 * @param string $display_name Display name for role. 1103 * @param bool[] $capabilities List of capabilities keyed by the capability name, 1104 * e.g. array( 'edit_posts' => true, 'delete_posts' => false ). 1121 * @since x.y.z Support was added for a numerically indexed array of strings for the capabilities array. 1122 * 1123 * @param string $role Role name. 1124 * @param string $display_name Display name for role. 1125 * @param array<string,bool>|array<int,string> $capabilities Capabilities to be added to the role. 1126 * Default empty array. 1105 1127 * @return WP_Role|void WP_Role object, if the role is added. 1106 1128 */
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)