Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: role_has_cap

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
85            * Filters which capabilities a role has.
86            *
87            * @since 2.0.0
88            *
89            * @param bool[] $capabilities Array of key/value pairs where keys represent a capability name and boolean values
90            *                             represent whether the role has that capability.
91            * @param string $cap          Capability name.
92            * @param string $name         Role name.
93            */
94           $capabilities = apply_filters( 'role_has_cap', $this->capabilities, $cap, $this->name );
95
96           if ( ! empty( $capabilities[ $cap ] ) ) {
97                return $capabilities[ $cap ];
98           } else {
99                return false;
100           }
101      }
102
103 }