Skip to content

Instantly share code, notes, and snippets.

@ericnicolaas
Created June 2, 2019 23:14
Show Gist options
  • Save ericnicolaas/e7118bb0bf918c672d024a6e113f340d to your computer and use it in GitHub Desktop.
Save ericnicolaas/e7118bb0bf918c672d024a6e113f340d to your computer and use it in GitHub Desktop.
Add Campaign Manager capabilities to Editor role
add_action(
'init',
function() {
$campaign_manager = get_role( 'campaign_manager' );
$editor = get_role( 'editor' );
foreach ( $campaign_manager->capabilities as $cap => $has_cap ) {
if ( ! $has_cap ) {
continue;
}
if ( ! $editor->has_cap( $cap ) ) {
$editor->add_cap( $cap );
}
}
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment