functions.php
/*////////////////////////////////////////////////
//
// Clone editor role to PJ Editor and remove 'publish_posts' capability
//
////////////////////////////////////////////////*/
function cloneRole()
{
global $wp_roles;
if ( ! isset( $wp_roles ) )
$wp_roles = new WP_Roles();
$editor = $wp_roles->get_role('editor');
//Adding a 'new_role' with all admin caps
$wp_roles->add_role('pj_editor', 'PJ Editor', $editor->capabilities);
}
add_action('init', 'cloneRole');
function remove_pjeditor_capabilities() {
$pjeditor = get_role( 'pj_editor' );
$caps = array(
'publish_posts',
);
foreach ( $caps as $cap ) {
$pjeditor->remove_cap( $cap );
}
}
add_action( 'init', 'remove_pjeditor_capabilities' );