user_can() (funzione WordPress) verifica se (il ruolo di) un utente ha una delle capabilities, restituendo un valore booleano
tips&tricks
There is an undocumented, third argument, $args, that may include the object against which the test should be performed. E.g. Pass a post ID to test for the capability of that specific post.
Sintassi
user_can($user, $capability)
| parametro | descrizione |
|---|---|
| $user | Lo user da processare, da indicarsi attraverso ID o oggetto WP_Role |
| $capability | La capability da processare |
Esempi
echo user_can(1, "activate_plugins"); // true
Contenuti correlati
- CSS
- HTML
- JavaScript
- jQuery
- PHP
- SQL
- WORDPRESS
0 Comment