Add caps on theme activation
-
Hello, I want to add caps on theme activation.
I try this (the second) but it doesn’t recognize the activation and removes caps anyway.
My function:
function add_theme_caps() { global $pagenow; $role = get_role('administrator'); if ('themes.php' == $pagenow && isset($_GET['activated'])) { // Test if theme is active $caps = array( 'activate_plugins', ); foreach ($caps as $cap) { $role->add_cap($cap); } } else { $caps = array( 'activate_plugins', ); foreach ($caps as $cap) { $role->remove_cap($cap); } } } add_action('load-themes.php', 'add_theme_caps');
Can you help me?
Thanks.PS: my original issue is about adding cpt custom caps
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Add caps on theme activation’ is closed to new replies.