Skip to content

Instantly share code, notes, and snippets.

@blogjunkie
Last active March 2, 2020 14:51
Show Gist options
  • Select an option

  • Save blogjunkie/6736573c83cfc6a6aeacefdf1db9fecd to your computer and use it in GitHub Desktop.

Select an option

Save blogjunkie/6736573c83cfc6a6aeacefdf1db9fecd to your computer and use it in GitHub Desktop.
Disable Thrive Architect (Content Builder) on specific post types
<?php // Do not copy this line
// Define a blacklist of posts that you don't want TCB to be enabled on
function sfp_tcb_blacklist() {
$blacklist = array(
'post',
'page',
'product'
);
return $blacklist;
}
// Disable the TCB functionality on the blacklisted post types
add_filter( 'tcb_post_editable', function($post_type, $post_id) {
if ( in_array( $post_type, sfp_tcb_blacklist() ) ) {
return false;
}
else {
return true;
}
}, 99, 2 );
// Remove edit with Thrive Architect button from block editor for blacklisted post types
add_filter( 'tcb_gutenberg_switch', function() {
if ( in_array( get_post_type(), sfp_tcb_blacklist() ) ) {
return true;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment