function add_cap_subscriber(){ //Nombre de la función
$role = get_role( 'subscriber' ); //Instaciamos el role en la variable $role
$role->add_cap( 'edit_posts'); //Agregamos la cabability usando el método add_cap().
$role -> remove_cap( 'edit pages' ); //Elimina la capacidad
}
//add_action(Hook, Nombre de la función)
add_action( 'init', 'add_cap_subscriber');
//https://wordpress.org/documentation/article/roles-and-capabilities/#administrator
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter