How to enable Visual Composer for admin users on Multisite setup?

  1. Home
  2. Docs
  3. How to’s
  4. How to enable Visual Composer for admin users on Multisite setup?

How to enable Visual Composer for admin users on Multisite setup?

WordPress disables custom HTML for administrators on a multisite network. It is available for the super admin user. Unfortunately, due to this, the Visual Composer's behaviour is also affected.

The Visual Composer can be enabled for an admin user by adding following code in theme functions.php file:

function multisite_restore_unfiltered_html($caps, $cap, $user_id, $args)
{
    
    $users = [3]; //replace with admin user id here

    if ('unfiltered_html' === $cap && in_array($user_id, $users, true)) {
        $caps = ['unfiltered_html'];
    }

    return $caps;
}

add_filter('map_meta_cap', 'multisite_restore_unfiltered_html', 1, 4);

The only change needed is to replace the number in:

$users = [3];

with the user id assigned to the admin user on your setup.

Was this article helpful to you? No Yes

How can we help?