Enable Divi Builder by Default on New Posts / Pages

Written by Dan Mossop

The Divi Theme gives you the option of using the Divi Builder drag and drop editor on your posts and pages. This is normally something you have to explicitly enable by clicking on the "Use Divi Builder" button on every single post / page you start. Wouldn't it be great if you could have the Divi Builder automatically enabled on your new posts and pages? Here's how to do it.

Enable the Front-End Visual Builder by Default using Divi Booster

Divi Booster includes an option to make front-end visual Divi Builder the default editor. You'll find it on the Divi Booster settings page, at:

Divi Builder > General > Enable Divi Builder by default on new pages / posts

Simply check the box to enable the option, and then save your changes. The Divi Builder should now automatically be enabled on new posts and pages.

Custom Post Types

The feature also works on Custom Post Types. However, you may need to enable the Divi Builder on your Custom Post Type in the Divi Theme Options at:

Divi > Theme Options > Builder > Post Type Integration > Enabler Divi Builder on Post Types

Supported Version

The option is available in Divi Booster from version 2.5.9 onwards. Early versions of the feature only supported the classic editor, but since version 3.2.2 the feature also works with the WordPress block editor (aka "Gutenberg").

Enable the Back-End Visual Builder by Default

Divi includes a built-in way to enable the back-end version of the Divi Builder by default.

To do so, we must disable the WordPress block editor, which can be done by disabling this option:

Divi > Theme Options > Builder > Advanced > Enable Classic Editor

This will restore the old and largely unsupported "Classic" version of the Divi Builder. To enable the "Latest Divi Builder Experience" instead (i.e. the same version of the builder that you get on the front-end), enable this option:

Divi > Theme Options > Builder > Advanced > Enable The Latest Divi Builder Experience 

Enabling the Divi Builder using PHP

If you're comfortable adding PHP code to Divi, you can use the following code to set the Divi Builder as the default editor on new posts:
class DBCOMEnableBuilderByDefault {
		
	function init() {
		add_action('load-post-new.php', array($this, 'enableDiviBuilderByDefault')); 
	}

	public function enableDiviBuilderByDefault() {
		$this->enableVisualBuilderByDefault();
		$this->enableClassicBuilderByDefault();
	}

	protected function enableVisualBuilderByDefault() {
		add_action('wp_insert_post', array($this, 'convertToVisualBuilderPost'), 10, 2);
	}

	public function convertToVisualBuilderPost($post_id, $post) {
		remove_action('wp_insert_post', array($this, 'convertToVisualBuilderPost'), 10, 2); 
		if (isset($post->post_type) && in_array($post->post_type, $this->et_builder_get_enabled_builder_post_types())) {
			$this->setPostStatusToDraft($post_id);
			$this->enableDiviBuilder($post_id);
			$this->redirectToVisualBuilder($post_id);
		}
	}

	protected function et_builder_get_enabled_builder_post_types() {
		if (!function_exists('et_builder_get_enabled_builder_post_types')) { 
			return array(); 
		}
		return et_builder_get_enabled_builder_post_types();
	}

	protected function setPostStatusToDraft($post_id) {
		$unique_title = __('Auto Draft').' '.$post_id;
		wp_update_post(array('ID'=>$post_id, 'post_status'=>'draft', 'post_title'=>$unique_title));
	}

	protected function enableDiviBuilder($post_id) {
		update_post_meta($post_id, '_et_pb_use_builder', 'on');
	}

	protected function redirectToVisualBuilder($post_id) {
		$builderUrl = $this->et_fb_get_builder_url(get_the_permalink($post_id), 'vb');
		if (wp_redirect($builderUrl)) {
			exit;
		}
	}

	protected function enableClassicBuilderByDefault() {
		if ($this->bfbEnabled()) { 
			return; 
		}
		add_filter('et_builder_always_enabled', '__return_true');
	}

	protected function et_fb_get_builder_url($url, $builder) {
		if (!function_exists('et_fb_get_builder_url')) { 
			return false; 
		}
		return et_fb_get_builder_url($url, $builder);
	}

	protected function bfbEnabled() {
		return (function_exists('et_builder_bfb_enabled') && et_builder_bfb_enabled());
	}
}

$option = (new DBCOMEnableBuilderByDefault);
$option->init();

Maximize Your Divi Building Efficiency

The Divi Booster plugin simplifies your workflow by enabling the Divi Builder by default on new posts and pages. No more repetitive clicks—just seamless editing right from the start. Ideal for enhancing consistency and efficiency across your site.

About Dan Mossop

Dan is a Scottish-born web developer, now living in Brisbane with his wife and son. He has been sharing tips and helping users with Divi since 2014. He created Divi Booster, the first Divi plugin, and continues to develop it along with 20+ other Divi plugins. Dan has a PhD in Computer Science, a background in web security and likes a lot of stuff, 

8 Comments

  1. Hey,

    I tried your code to switch the default new post editor to Divi:

    add_action('load-post-new.php', 'dbc_load_post_new_php');
    function dbc_load_post_new_php() {
    add_filter('et_builder_always_enabled', '__return_true');
    };

    but it doesn't work. I put it into functions.php and I'm using WordPress v6.1.1

    Reply
    • Hey Mauricio, I've just replaced the code in the post with the longer version used by the current version of Divi Booster. I've tested it on WP 6.1.1 and the current version of Divi and it seems to be working correctly. Hopefully it will work for you, but let me know if you have any further issues with it. Thanks!

      Reply
  2. Hi Dan, I've enabled this in Divi Booster but it is opening new pages/posts into the Front End builder. Is there any way to get it to open into the Classic Builder instead?

    Thank you.

    Reply
    • Hey Dave, yes, you can enable the Classic Builder using options within Divi itself. I've just added a "Enable the Back-End Visual Builder by Default" section to the post that explains how. Note that you should disable the Divi Booster option if you're using this approach. I hope that helps!

      Reply
      • Ah I see. I didn't know about that setting. Thanks!

        Reply
        • You’re welcome, Dave!

          Reply
  3. What is the PHP code for determining which pages/posts currently use the Divi Builder?

    What is the PHP code for un-doing et_builder_always_enabled, to set "Always Use Gutenberg Editor" for new pages/posts?

    Reply
    • Hey George,

      1) you should be able retrieve the posts / pages currently using the Divi Builder with the following:

      $builder_posts = get_posts( array(
        'meta_key'   => '_et_pb_use_builder',
        'meta_value' => 'on',
      ));
      

      This will return an array of WP_Post objects of those pages / posts using Divi Builder.

      2) You can override the et_builder_always_enabled setting with this:

      add_filter('et_builder_always_enabled', '__return_false', 9999);

      You need to make sure the "priority" is set such that it comes after any other filter which is setting it to true. Here I've set the priority to 9999 which will probably be plenty in most cases (a larger number = value is set later).

      I haven't played around with it enough to know if that's enough by itself to achieve the desired "Always Use Gutenberg Editor" setting. If not, let me know and I'll dig into it some more. Thanks!

      Reply

Submit a Comment

Comments are manually moderated and approved at the time they are answered. A preview is shown while pending but may disappear if your are cookies cleared - don't worry though, the comment is still in the queue.

Your email address will not be published. Required fields are marked *.

We may earn a commission when you visit links on our website.