Changing settings of built-in Visual Composer elements

If you are working with Visual Composer, you probably want to have some block settings set by default every time you create a block. For example, when you would create an Image gallery I wanted the gallery type to be set to “Flex slider slide”, the slides interval to be set to 10 seconds and the Image Size to be set to large. Thankfully you can do this via the very useful vc_map_update() function!

Here is an example that changes settings on the default Image Gallery block. You can use this in your themes functions.php file or a plugin.

add_action('init', function()
    //Get VC gallery shortcode config
    $shortcode_vc_gallery_tmp = WPBMap::getShortCode('vc_gallery');

    //Loop over config to find the condition we want to change
    foreach($shortcode_vc_gallery_tmp['params'] as $key => $param)
        //We found our parameter to change, woop!
        if($param['param_name'] === 'img_size')
            //Add standard value for gallery size
            $shortcode_vc_gallery_tmp['params'][$key]['value'] = 'large';
        else if($param['param_name'] === 'interval')
            //Add standard value for gallery transition
            $shortcode_vc_gallery_tmp['params'][$key]['std'] = 10;
        else if($param['param_name'] === 'type')
            //Add standard value for gallery easing
            $shortcode_vc_gallery_tmp['params'][$key]['std'] = 'flexslider_slide';


    //VC doesn't like even the thought of you changing the shortcode base, and errors out, so we unset it.

    //Update the actual parameter
    vc_map_update('vc_gallery', $shortcode_vc_gallery_tmp);
}, 100);

14 thoughts on “Changing settings of built-in Visual Composer elements

    1. Stanislav Khromov Post author

      Hey sodbileg,

      Yes this works fine with VC 4.1.1, I am using it on a project right now. :)

    2. Stanislav Khromov Post author

      Hey again sodbileg,

      Upon further inspection the code did actually break in version 4.1.1, due to changed hook timings in Visual Composer.

      The fix is very simple, we just change the hook to init with a priority of 100, and everything works again. I have updated the above code to reflect those changes. They should work fine on older VC versions as well.

      1. sodbileg

        Hi Stanislav,
        Thank you so much for sharing your fix.
        After I posted a comment on your blog, I looked at VC page on CodeCanyon.
        I found a solution below from there. If you are interested, this is the solution.

        add_action('init', 'vc_map_default_shortcodes'); //replace this line with a line below
        add_action( 'plugins_loaded', 'vc_map_default_shortcodes' );

        Thank you again :)

        1. Stanislav Khromov Post author

          Thanks sodbileg,

          It sounds like this will be fixed in the next version of VC – Looks like a lot of people are having issues with the changes in hook timings. I’ll keep track on how the issue progresses. :)

  1. Jeff

    Everytime I publish a post I get an email notification from The problem is the looks like the following…

    [vc_row][vc_column width=”1/1″][vc_column_text]I am text block. .[/vc_column_text][/vc_column][/vc_row][vc_row][vc_column width=”1/1″][vc_column_text]

    This is due to using VIsual Composer to create the post. The email contains part of the body of the post which is formatted for visual composer but looks like this in HTML and plain text.

    Is there anyway to format this email so it shows up correctly?

    Thanks for any help!

    1. Stanislav Khromov Post author

      Hey Jeff,

      WordPress (the open-source .org version) has no feature that sends an email when a new post is published, so you’d have to check with the third party plugin you are using for this. But regardless, it’s outside the scope of this article. Hope that helps.

  2. Jeff

    Thank you for the response!!

    It turned out to be caused by Jetpack which is a plugin co-Authored by that was actually firing the email notification through, even though the Blog is hosted elsewhere.

    The problem with the email is that it contained Visual Composer code elements like so…
    [vc_row][vc_column width=”1/1″][vc_column_text] This is content. This is where the main body of the post belongs [/vc_column_text][/vc_column][/vc_row][vc_row][vc_column width=”1/1″]

    I was thinking it was some kind of setting in Visual Composer. I had to disable Jetpack, which ties a blog to Doing this stopped the email.

    Thank you very much for the feedback!

  3. Pingback: Override Visual Composer default element settings (example included) | - WordPress website ontwikkeling. Door echte experts.

Leave a Reply

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

Markdown is allowed in comments.