Disable Divi AI by default in the Divi Role Editor


Divi's built-in artificial intelligence feature, Divi AI, lets you quickly generate content and images for your Divi modules. For designers and agencies, maintaining control over its usage by clients can be crucial. Disabling Divi AI where it is not needed helps keep the interface streamlined for clients, but it also conserves the agency’s own Divi AI resources. In this post, we'll guide you through the process of changing how the Divi AI role editor option works – allowing you to disable it by default for non-administrators, disable it by default for administrators, and / or keep it permanently disabled. 

Please note that the PHP code given in this post must be deployed on the client's site (e.g. via a child theme or custom plugin), and could be removed again by a sufficiently knowledgeable / motivated client. As such, it should be considered more of a barrier to their use of Divi AI than a fool-proof security mechanism.

Disabling Divi AI by default for non-administrators

Divi AI can be deactivated in the Divi role editor, but if you manage a lot of sites and want to streamline the process, you can use the PHP code below to disable Divi AI for all non-administrator roles by default. This minimizes potential interface clutter and ensures only the necessary functions are available for these user roles.

// === Disable Divi AI for non-administrators by default === //

if (false === get_option('et_pb_role_settings')) {
    add_option( 'et_pb_role_settings', array());

add_filter('option_et_pb_role_settings', 'dbc_disable_divi_ai_by_default');

function dbc_disable_divi_ai_by_default($option) {

	$allow_on_admin = apply_filters('dbc_disable_divi_ai_allow_on_admin', true);
	$allow_reactivation = apply_filters('dbc_disable_divi_ai_allow_reenable_in_role_editor', true);
    // Get a list of user roles
    $roles = array('administrator', 'editor', 'author', 'contributor'); 
    if (function_exists('et_pb_get_all_roles_list')) {
        $et_pb_roles = et_pb_get_all_roles_list();
        if (is_array($et_pb_roles)) {
          $roles = array_keys($et_pb_roles);

	// Disable "Divi AI" role as needed
    if (!is_array($option)) { 
        $option = array(); 
    foreach($roles as $role) {
        if ($allow_on_admin && $role === 'administrator') { 
        if (!isset($option[$role]) || !is_array($option[$role])) { 
            $option[$role] = array(); 
        if (!$allow_reactivation || !isset($option[$role]['divi_ai'])) { 
            $option[$role]['divi_ai'] = 'off'; 

    return $option;

Note that this sets the default value for the Divi AI option, which is used in the event that there is not already a value set for the Divi AI state. It won't work if the role editor options have already been saved since the Divi AI role editor option was introduced – in that case the value set at the time of the save will be used. Likewise, if the Divi AI role editor option is enabled for a role and saved after installing this code, this newly set value will override the default.

Disabling Divi AI by default for administrators

To extend this default to include administrators, you can add this PHP code to that given above.

// Optional - disallow Divi AI for administrators by default
add_filter('dbc_disable_divi_ai_allow_on_admin', '__return_false');

With this piece of code, Divi AI will also be disabled for administrators by default. They can, of course, re-enable it in the role editor if they wish.

Preventing re-activation of Divi AI from within the role editor

If you need to ensure that the Divi AI feature remains disabled and cannot be re-enabled later in the Role Editor, add this code snippet to they above:

// Optional - disallow reactivation of Divi AI via the role editor
add_filter('dbc_disable_divi_ai_allow_reenable_in_role_editor', '__return_false');

This code prevents those roles for which Divi AI is off by default from switching the Divi AI feature back on from within the Role Editor setting, effectively making them permanently disabled. 

Note that in the role editor, it will look like the setting can be re-activated and saved, but when the role editor is reloaded you should see that the setting is actually still disabled. Likewise Divi AI should remain unavailable in the Divi Builder interface for those roles.

By controlling access to the Divi AI feature, you can ensure a focused and simplified interface for your clients and better manage your own Divi AI quota.

This post may contain referral links which may earn a commission for this site

Divi Booster

Hundreds of new features for Divi
in one easy-to-use plugin


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 *.