John Fridinger, one of our readers and a Divi Children user, pointed out yesterday an issue he found while working on his new site with Divi 2.0 (thanks, John). He realized that when clicking on the “Load Layouts” button of the Page Builder, the available predefined layouts were duplicated.

It all looked like an issue that had to do with Divi child themes when John discovered that a ticket had already been opened at the ET support forum on this very same topic.

I wasn´t using predefined layouts myself, so I didn´t notice this issue until now. But when I clicked on “Load Layout” I found I had 7 repeated sets of predefined layouts on one of my Divi 2.0 test sites! Then I created a new child theme and nothing happened, but once I activated the new child theme I got yet another set of repeated predefined layouts.

Nothing harmful

I wanted to investigate where this problem came from, and I discovered that it is something that will happen every time a new child theme of Divi 2.0 is activated, no matter how you created the child theme.

Here is why:

Divi uses custom post types for layouts, which of course are saved on the WP database in the wp_posts table. As it is right now, every time you activate a new child theme, the Divi Page Builder code saves a new set of predefined layouts.

Because posts belong to your site and not to your theme, the repeated predefined layouts keep on growing every time you activate a new child theme and are always appearing there, even if you deactivate and delete your child themes.

It is nothing harmful but it sure is disconcerting, plus it is a bug and it should be fixed.

The issue explained

The culprits are a couple of functions in the layouts.php file, which is in the “layouts” subfolder of the Divi 2.0 theme (/Divi/et-pagebuilder/layouts/).

The first function is et_pb_update_predefined_layouts():

This function is hooked to admin_init, so it will run when the admin area is accessed.

When a new child theme has just been created and activated, the theme mod et_pb_predefined_layouts_updated_2_0 does not exist yet, so the function will not return.

The same thing happens with the other theme mod: et_pb_predefined_layouts_added doesn´t exist either, so the existing predefined layouts will not be deleted.

Nevertheless, a new set of predefined layouts will be created by calling another function: et_pb_add_predefined_layouts(), hence the duplicated layouts are generated.

Elegant Themes to fix this issue

As a result of the ET support ticket I mentioned above, a member of the Elegant Themes support staff said that “we’ll modify that function and layouts will not be duplicated anymore. We’ll fix it in next theme update“.

So, as soon as Divi 2.0 gets updated with the next release, this issue is supposed to disappear.

What to do meanwhile

As I´ve said before, this issue is not harmful at all. That means that you can go on working on your Divi 2.0 site with no problems at all, except you will see your available predefined layouts repeated if you´re using a child theme.

Since I strongly recommend to always use a child theme if you´re planning to do any customization to your theme (that´s why I created the Divi Children plugin in the first place), I don´t want you to feel uncomfortable with this bug, so here are some ways to overcome it while you wait for the next Divi theme update from Elegant Themes:

Fix it modifying the parent theme

For the same reason that I encourage to use child themes, I don´t like modifying a parent theme. But in this particular case, since this issue is supposed to get fixed with the next update from Divi 2.0, you can tweak your Divi 2.0 because whatever change you do now it will be overwritten the next time you update Divi.

The fix for the parent theme is simple: you just need to change a line in the et_pb_update_predefined_layouts()function of layouts.php:

Fix it with your child theme

You can also fix this issue without touching your Divi 2.0 parent theme. To do so, add the following code to the functions.php of your child theme:

Leave it to the Divi Children plugin

If you are not using a child theme yet and you don´t feel like writing code and messing with ftp, let Divi Children do the work for you.

At the moment I´m focused on the 2.0 version of this free plugin and, as I explained on my post Divi Children 2.0 sneak peek: Customizing Divi even further, without code, I´d planned to jump directly from Divi Children 1.0 to Divi Children 2.0. But as I encountered this issue I don´t want to keep you waiting so I´m releasing an intermediate 1.0.1 version to fix this bug.

That way, every child theme created by Divi Children will have the fixing code added to its functions.php, so you don´t have to worry about this issue.

Update: Divi Children 1.0.1 has already been released.

Final words

If you´re already experiencing this issue because you created and activated a child theme of  Divi 2.0, all you have to do to make any of the above fixes work is to create and activate a new child theme.

Now if you happen to be thinking “What? I don´t want a new child theme fo Divi 2.0, I spent a lot of time and effort on my current child theme“, don´t worry at all. I didn´t mean you need to be using a new child theme: just create it and activate it. As long as you don´t give it a name that you´ve already used for a previous Divi child theme, the issue will get fixed and afterwards you can deactivate and delete that new “bogus” child theme and keep using your “real” child theme.

One more thing: I´ve checked it and found that this issue is not unique to Divi 2.0 (actually, the featured image I´m using for this post comes from a site running on Divi 1.7). Anyway, since there the affected code has changed with the release of Divi 2.0, I´m not addressing here any fixes for any version prior to Divi 2.0. If you are using an older version, you should update to Divi 2.0. You won´t regret it, by the way.

Disclosure: Some of the links in this post are affiliate links. This means if you click on the link and purchase the item, the owner of this website will receive an affiliate commission.

Divi 2.0 predefined layouts, Divi Children 1.0.1

Luis Alejandre
Latest posts by Luis Alejandre (see all)

Get the new Divi 4.25... With a special membership discount for our users! Get your DISCOUNT on Divi

Pin It on Pinterest

Share This