Last active
March 2, 2020 14:51
-
-
Save blogjunkie/6736573c83cfc6a6aeacefdf1db9fecd to your computer and use it in GitHub Desktop.
Disable Thrive Architect (Content Builder) on specific post types
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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