Snippet: Disable the WPBakery Page Builder for Specific Post Types
WPBakery has some built-in role options so you can set the post types available for WPBakery on a per-user role. This is ok, but it really doesn't make much sense. For the most part if you are going to disable WPBakery for a post type it will be done for all roles.
Additionally, if you are a super-admin WPBakery appears to be enabled for every post type regardless of your user role settings - which we believe is a bug and have reported it before, but I don't think the plugin developers see it as a bug.
The following snippet can be used to disable WPBakery completely for specific post types.
/**
* Disable WPBakery for specific post types.
*/
add_filter( 'vc_check_post_type_validation', function( $check, $post_type ) {
$now_allowed = [
'post_type_1',
'post_type_2',
'post_type_3',
];
if ( in_array( $post_type, $not_allowed, true ) ) {
$check = false;
}
return $check;
} );
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)
We recommend Code Snippets (100% Free) or WPCode (sponsored)