Blog Post Icon

How to adjust WPBakery Visual Composer to pass Google core web vitals

WPBakery Visual Composer Speed Improvements Core Web Vitals

Website speed matters now more than ever. If you’re using WPBakery Visual Composer on WordPress, you know it’s a fantastic tool for creating stunning websites. But its impact on performance can’t be ignored. Bloated code and excessive requests slow things down, hurting both user experience and SEO. Let’s dive into some practical tips and technical know-how to optimize your site’s speed and ensure it passes Google’s Core Web Vitals benchmarks.

Understanding the Challenge

WPBakery Visual Composer makes website building easy, but it comes with a speed cost. Bloated code and render-blocking scripts can seriously slow things down. This affects how users interact with your site and can hurt your search engine rankings.

Making the Most of Key Tools

1. WP Rocket: Turbocharge Your Caching

WP Rocket is a powerhouse for optimizing site performance. Here’s how you can configure it:

  1. Install and activate the WP Rocket plugin from the WordPress plugin repository.
  2. Navigate to the WP Rocket settings in your WordPress dashboard.
  3. Enable features such as page caching, GZIP compression, and browser caching.
  4. Configure advanced settings according to your site’s requirements.
  5. Save your changes and test your site’s performance.

By caching pages and enabling GZIP compression and browser caching, WP Rocket significantly improves loading times, which is key for meeting Core Web Vitals standards.

2. Autoptimize: Streamline JS and CSS

Autoptimize is your go-to for optimizing CSS and JavaScript. Here’s how you can configure it:

  1. Install and activate the Autoptimize plugin from the WordPress plugin repository.
  2. Navigate to the Autoptimize settings in your WordPress dashboard.
  3. Enable options for optimizing CSS and JavaScript files.
  4. Configure additional settings such as minification and concatenation.
  5. Save your changes and test your site’s performance.

By minifying and combining assets, Autoptimize reduces HTTP requests and improves loading times, crucial for Core Web Vitals.

3. Nginx: Unleash Server-Side Speed Enhancements

Nginx offers a range of optimizations. Here’s a snippet to enable GZIP compression:

# Enable GZIP compression
    # GZIP Settings
    gzip on;
    gzip_min_length 256;
    gzip_comp_level 6;
    gzip_buffers 32 16k;
    gzip_http_version 1.1;
    gzip_proxied any;
    gzip_vary on;
    gzip_types *;

With browser caching and HTTP/2 support, Nginx can significantly boost your site’s performance. You can also utilize brotli compression :

    # Brotli Settings
    brotli on;
    brotli_comp_level 6;
    #brotli_buffers 32 8k;
    #brotli_min_length 100;
    brotli_static on;
    brotli_types application/atom+xml application/javascript application/json application/rss+xml
             application/ application/x-font-opentype application/x-font-truetype
             application/x-font-ttf application/x-javascript application/xhtml+xml application/xml
             font/eot font/opentype font/otf font/truetype image/svg+xml image/
             image/x-icon image/x-win-bitmap text/css text/javascript text/plain text/xml;

Lastly you want to utilize the nginx expires configuration directive to allow for manipulation of the Expires and Cache-Control header to facilitate local browser caching :

    # Expires for local caching
    expires 1y;

4. Varnish Cache: Amplify Your Caching Strategy

Varnish Cache acts as a powerful reverse proxy server. Setting it up involves configuring caching rules to integrate closely with WordPress’ URL structure most importantly to accommodate what to cache and what not to cache.

Most of the configuration within varnish will happen within the vcl_recv configuration rules.

Strip all cookies except whats important

            set req.http.Cookie = regsuball(req.http.Cookie, "(^|; ) *_ok(?:[bklv]{2})?=[^;]+;? *", "\1"); # removes olark cookies (_ok, _okkb, _oklv)
            set req.http.Cookie = regsuball(req.http.Cookie, "(^|; ) *hblid=[^;]+;? *", "\1"); # removes olark cookie (hblid)
            set req.http.Cookie = regsuball(req.http.Cookie, "(^|; ) *wcsid=[^;]+;? *", "\1"); # removes olark cookie (wcsid)
            set req.http.Cookie = regsuball(req.http.Cookie, "(^|; ) *olfsk=[^;]+;? *", "\1"); # removes olark cookie (olfsk)
            set req.http.Cookie = regsuball(req.http.Cookie, "(^|; ) *omp__super_properties=[^;]+;? *", "\1"); # removes olark cookie (omp__super_properties)
            # Remove has_js and Google Analytics __* cookies.
            set req.http.Cookie = regsuball(req.http.Cookie, "(^|;\s*)(__[a-z]+|has_js)=[^;]*", "");
            # Remove a ";" prefix, if present.
            set req.http.Cookie = regsub(req.http.Cookie, "^;\s*", "");
            # Remove empty cookies.
            if (req.http.Cookie ~ "^\s*$") {
                unset req.http.Cookie;

The above snippet can be customized to accommodate any custom cookies that are in use on your site.

Rewrite all non-HTTPS requests

This is optional but since Varnish is likely the edge of incoming requests, is most ideal to rewrite non-HTTPS request to the HTTPS version of your site :

            if (req.http.X-Forwarded-Proto !~ "(?i)https") {
                 set req.http.x-Redir-Url = "" + req.url;
                 return (synth(750, req.http.x-Redir-Url));

Dont forget to also set the vcl_synth function to handle the redirect :

sub vcl_synth {
 #redirect to
    if (resp.status == 750) {
        set resp.http.Location = resp.reason;
        set resp.status = 301;

Dont cache admin or login requests

We absolutely do not want to cache the admin dashboard or login requests. This means we want to match URL patterns to ensure this never happens in varnish. We dont want a cached admin page to be visible to the anonymous user!

            if (req.url ~ "^/wp-admin/(.*)"){
               set req.backend_hint = your.backend();

            if (req.url ~ "^/wp-login.php(.*)"){
               set req.backend_hint = your.backend();

            if (req.method == "POST") {
               set req.backend_hint = your.backend();

Finish off vcl_recv by caching everything else

The snippet below for varnish configuration will include ensuring all images are cached and the last directive if none of the other above patterns match is to just cache everything else :

            if (req.url ~ ".(gif|jpg|jpeg|png|css|js)") {
               set req.backend_hint = shift8stockfarm.backend();
               return (hash);

            set req.backend_hint = shift8stockfarm.backend();
            return (hash);

By caching static assets, Varnish Cache reduces server load and improves loading times, essential for meeting Core Web Vitals standards.

Improve core web vitals and speed improvements to wpbakery visual composer

5. WPBakery Visual Composer Options: Fine-Tune for Performance

Within WPBakery Visual Composer, you have control over asset loading and library usage. Here’s an example of a functions.php change :

// Remove unnecessary WPBakery Visual Composer elements
add_action('vc_before_init', 'my_vc_remove_elements');
function my_vc_remove_elements() {

Remove gutenberg block library css from loading on the front end

If you are not using gutenberg (especially if you are using visual composer), you want to trim the library CSS from being loaded on the front end of your site :

//Remove Gutenberg Block Library CSS from loading on the frontend
function shift8_remove_wp_block_library_css(){
    wp_dequeue_style( 'wp-block-library' );
    wp_dequeue_style( 'wp-block-library-theme' );
    wp_dequeue_style( 'wc-blocks-style' ); // Remove WooCommerce block CSS
    wp_dequeue_style( 'vc_font_awesome_5' );
    wp_dequeue_style( 'vc_carousel_css' );
    wp_deregister_style( 'vc_font_awesome_5' );
    wp_deregister_style( 'vc_carousel_css' );
add_action( 'wp_enqueue_scripts', 'shift8_remove_wp_block_library_css', 100 );

Remove Visual Composer scripts that aren’t needed

Similarly to the gutenberg change above, you may not need the entire (bloated) visual composer library assets / scripts to be loaded for every page. You can expand on the snippet below to include the script libraries that are not needed for your site :

// Remove enqueued scripts that arent needed
add_action( 'wp_print_scripts', 'shift8_dequeue_script', 100 );
function shift8_dequeue_script() {
       wp_dequeue_script( 'vc_carousel_js' );
       wp_dequeue_script( 'vc_pageable_owl' );

add_filter( 'script_loader_tag', 'shift8_defer_scripts', 10, 3 );

The next snippet can technically be accommodated by Autoptomize or WP Rocket but its important to note that we can also selectively set loaded JS scripts to be deferred via a functions.php change in your theme :

add_filter( 'script_loader_tag', 'shift8_defer_scripts', 10, 3 );
function shift8_defer_scripts( $tag, $handle, $src ) {

    // The handles of the enqueued scripts we want to defer
    $defer_scripts = array(
    if ( in_array( $handle, $defer_scripts ) ) {
        return '' . "\n";
    return $tag;

The above snippet simply searches for a script label identifier (in the above case its “popmodern”) and search/replaces the html before its rendered in the browser to include the defer statement in the script tag. The “defer_scripts” array can be added to and modified in the above snippet to accommodate whatever you need.

Fine-tuning these aforementioned settings reduces bloat and ensures smoother performance, aligning with Core Web Vitals requirements recommendations.

Putting It Into Practice

With these practical strategies and technical insights, you’re ready to optimize your WPBakery Visual Composer site for speed and performance. By implementing caching mechanisms, streamlining asset delivery, and fine-tuning settings, you’ll enhance user experience and maintain strong search engine rankings.


Optimizing your WPBakery Visual Composer site for speed is crucial in today’s competitive online landscape. By leveraging tools like WP Rocket, Autoptimize, Nginx, Varnish Cache, and WPBakery Visual Composer, you’ll ensure your site not only loads quickly but also meets Google’s Core Web Vitals criteria. So, roll up your sleeves, dive into the technical details, and take your site’s performance to the next level!

At Shift8, we cater to all sorts of businesses in and around Toronto from small, medium, large and enterprise projects. We are comfortable adapting to your existing processes and try our best to compliment communication and collaboration to the point where every step of the way is as efficient as possible.

Our projects are typically broken into 5 or 6 key “milestones” which focus heavily on the design collaboration in the early stages. We mock-up any interactive or unique page within your new website so that you get a clear picture of exactly how your design vision will be translated into a functional website.

Using tools like Basecamp and Redpen, we try to make the process simple yet fun and effective. We will revise your vision as many times as necessary until you are 100% happy, before moving to the functional, content integration and development phases of the project.

For the projects that are more development heavy, we make sure a considerable amount of effort is spent in the preliminary stages of project planning. We strongly believe that full transparency with a project development plan ensures that expectations are met on both sides between us and the client. We want to ensure that the project is broken into intelligent phases with accurate budgetary and timeline breakdowns.

Approved design mock-ups get translated into a browse-ready project site where we revise again and again until you are satisfied. Client satisfaction is our lifeblood and main motivation. We aren’t happy until you are.

Need Web Design?

Fill out the form to get a free consultation.

shift8 web toronto – 416-479-0685
203A-116 geary ave. toronto, on M6H 4H1, Canada
© 2024. All Rights Reserved by Star Dot Hosting Inc.

contact us
phone: 416-479-0685
toll free: 1-866-932-9083 (press 1)

Shift8 Logo