We use Beaver Builder (Pro) for a lot of client sites, and Beaver Themer as well to streamline layout creation.
For some sites, I don’t want clients to be able to override Themer Layouts. Essentially I want them to always have to hit the “Edit Content Only” button.
Is there a way to hardcode this option and disable the popup from their perspective? Or even just disable the option completely, across the board?
Well I went experimenting and I figured out a solution that works. Let me know though, if there’s a better way to do this?
/**
* Disable the "This post has a Themer layout assigned" pop-up by automatically
* setting `_fl_theme_builder_edit_mode` to 'content' (Edit Content Only).
*
* Note: this does not change pages that are *already* overridden or pages that
* are *manually* switched to "Override Layout" after Beaver Builder loads.
*/
function nh_force_bb_edit_mode() {
global $post;
$prev_edit_mode = get_post_meta( $post->ID, '_fl_theme_builder_edit_mode', true);
// Check to see if edit mode was already specified as "layout".
// If so, nothing is done. If not, it is set to "content".
if ($prev_edit_mode !== 'layout') {
update_post_meta( $post->ID, '_fl_theme_builder_edit_mode', 'content' );
}
}
add_action('fl_builder_editing_enabled', 'nh_force_bb_edit_mode', 1000);