Launch prices on MCP for Divi 5: $49 per year or $99 one-time.

Launch prices from $49

See pricing

Divi Code Snippet Generator

Tick the tweaks you need and we email you the code for your child theme's functions.php. Every snippet is checked against the Divi source code and works on Divi 5 and Divi 4.

Free · No account needed · Tested on Divi 5.15 and Divi 4.27

Pick your snippets

No code needed: Divi already has a setting

People often look for a snippet for these. Divi does them with a switch, which survives updates and is easier to undo than code.

Stop loading Google Fonts
Divi → Theme Options → General → Use Google Fonts
Add tracking or verification code to the head
Divi → Theme Options → Integration → Add code to the < head > of your blog
Turn the Divi Builder on for a custom post type
Divi → Theme Options → Builder → Post Type Integration
Critical CSS and deferring jQuery
Divi → Theme Options → Performance
Change the Blog module's excerpt length
The Excerpt Length setting in the Blog module itself
Upload custom fonts
The font picker in any module's Design tab, which has an upload option
Choose who can use the Divi Builder
Divi → Role Editor

Divi code snippet questions, answered

Where do I paste these snippets?

In your child theme's functions.php, below the opening <?php line. Never paste them into Divi's own functions.php: the next Divi update replaces that file and your code with it. No child theme yet? The free Divi Child Theme Generator makes one in a minute.

Do the snippets work on Divi 5?

Yes. Every snippet was checked against the Divi 5.15.1 and Divi 4.27.5 source code, and run on a Divi 5 site, before it was added. They work on both versions.

Why is there no snippet to turn off Google Fonts?

Because Divi already has a switch for it: Divi → Theme Options → General → Use Google Fonts. The same goes for head code, the builder on custom post types and the performance options. A snippet for something Divi already does only gives you two places to look when it stops working, so the list on this page points you to the setting instead.

What does the function prefix do?

It starts the name of every function in the code. WordPress stops with an error if two functions share a name, so a prefix of your own (your site or company name) keeps these snippets from clashing with your theme or plugins.

Something broke after I pasted a snippet. What now?

Remove the snippet you just added from functions.php, through your host's file manager or FTP if you cannot reach the dashboard. Every snippet only adds behaviour through a filter, so taking it out puts things back the way they were.