Skip to content

Snippet: Manually Disable WPBakery on Post Types For Specific User Roles

add_filter( 'vc_role_access_all_caps_role', function( $role ) {
	$user_role = 'editor'; // change this to the user role you want to manually enable WPBakery post types for
	if ( empty( $role->name ) && $user_role !== $role->name ) {
		return $role; // security check
	}
	$types = array( 'page', 'post', 'portfolio', 'staff', 'testimonials' );
	foreach ( $types as $type ) {
		unset( $role->capabilities['vc_access_rules_post_types/' . $type ] );
	}
	return $role;
} );
All PHP snippets should be added via child theme's functions.php file or via a plugin. We recommend Code Snippets (100% Free) or WPCode (sponsored)
Back To Top