How to add the Divi Builder to all Custom Post Types with one function

I doubt I need to convince anyone reading this that the Divi Builder is a powerful tool. It takes the heavy lifting out of creating new posts and pages and lets us reach our design potential before hitting our technical limitations, and that’s great! But every now and then you may install a plugin or third party software that adds a post type that doesn’t support the use of the Divi Builder by default. There are workarounds of course: Elegant Themes posted a great blog about how to add the Divi Builder to custom post types, and until recently, this was my own method for doing so. It works great but if you’re regularly adding plugins for testing, or have lots of CPT’s already and don’t want to go through finding the names of them all, then this method can be laborious.

However, it does give us a good base for a slightly different method. The following function doesn’t require you to know the name of your custom post types and it doesn’t even require you to update it if you add/remove plugins that load custom post types. Instead, what it does is get a list of all CPT’s currently being loaded on a site and then adds ET’s method to each of them automatically. So essentially, if you add this into your functions.php file, you can forget about the fact that CPT’s don’t have the Divi Builder option, because now they do.

function dpb_all_post_types( $post_types ) {

$post_types = get_post_types();

if ( $post_types ) { // If there are any custom public post types.
 foreach ( $post_types as $post_type ) {
 $post_types[] ='$post_type';

return $post_types;
add_filter( 'et_builder_post_types', 'dpb_all_post_types' );

Pretty cool, right?

Stephen James

SJ is a web developer living in the coastal town of Southsea, England. He is a Divi and WordPress advocate and the founder of Divi Space.

Previous post
Next post


  1. Fecsó

    Great tutorial! Thanks a lot.

  2. Heloish

    Hi, James, I tried this but it seems to remove the divi builder rather than add the builder. What could I be doing wrong? I pasted it into the functions.php and the site works fine.

    • Stephen James

      Hey, yeah I overlooked an issue with inbuilt post types. The code has been updated 🙂

  3. Bob

    Beautiful! Thanks so much! 😀

  4. Kan

    This is great! However, do you know how to get the “Divi Page Settings” on the right sidebar to show up on the CPTs so that we can change the “Page Layout” to “full width” and use other functions in the Divi Page Settings? Thank you very much!

  5. Dimitris

    I quess then it’s only me that removes the builder from “pages”. It works though with cpt. Also any way to take back side bar functionality?

  6. Sean

    Oh wow, there I was yesterday looking to solve this exact problem with CPTUI, and now have a much simpler way. Thank you so much.

  7. Alex

    Hi Stephen, does it implement Divi in left pane like the tutorial by ET or does your code implement Divi in full so I can for example use full width slider and it will actually be full width? Thanks.

  8. Daniel

    Works great!
    Thanks! 😀

    Any suggestions on how to add the full width option on these CPT ?

    Thanks again!

  9. Dan

    Nice one, SJ.

    I’ve been doing something similar for a while:

    The first function is pretty much the same as yours – I added a check that the CPT supports the WordPress editor box (as the builder won’t work without it), but I don’t think it’s essential.

    The other functions add a few useful enhancements, such as solving compatibility issues that can arise with certain CPTs.

  10. cliff

    Yes. This was really timely as I had this exact situation and this arrived in my inbox. Thank you!!!

  11. Jon

    If anyone wants to have access to the page layout/sidebar settings in the Divi Custom Post Settings box after choosing to use the Divi builder and with content on the page, just right-click and inspect the element in your browser.

    In ‘et_settings_meta_box’ you will see another div with the class of ‘inside’. In that you’ll see a paragraph whose class is ‘et_pb_side_nav_settings’. Just delete ‘style=”display: none;”‘ in your browser editor and the option to choose sidebars or a full page will then become available to use.

    I don’t know why Divi decided to hide this option but it works as it should when you remove that code. Hope that helps.

  12. John Raymond Quijano Tanedo

    This works but when you try to load a lay out from your library the layouts do not show. Help please?

    • Jon

      Sean has a solution for Library items:

      add_filter( ‘et_pb_show_all_layouts_built_for_post_type’, ‘sb_et_pb_show_all_layouts_built_for_post_type’ );

      function sb_et_pb_show_all_layouts_built_for_post_type() {
      return ‘page’;

  13. Tim

    Thanks this helped a lot

  14. Sarah Crawford

    Beautiful! love love love this so much. Thanks SJ


Submit a Comment

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

Receive notifications about our new blog posts.