Visual Composer (WPBakery) tabs issue when linking directly to an inner tab (like #phponline) using a URL anchor

this is a common Visual Composer (WPBakery) tabs issue when linking directly to an inner tab (like #phponline) using a URL anchor.

Let’s break it down and fix it step-by-step 👇


Why it happens

Visual Composer (VC) tabs rely on JavaScript initialization that runs after page load, and it only activates the first tab by default (the one with vc_active).

When you open a link like:

https://phponline.in/keys/#phponline

The page loads fine, but VC’s JS doesn’t “listen” to the hash (#phponline) — so it keeps showing the first tab instead of activating the one in the URL.


Fix Options

Option 1: Add small JavaScript to auto-switch tab from URL hash

Add this custom JS snippet in your site footer (or “Custom JS” area if your theme/VC has one):

jQuery(document).ready(function($) {
var hash = window.location.hash;
if (hash) {
var $tabLink = $('a[href="' + hash + '"]');
if ($tabLink.length) {
// Remove active classes from all tabs and content
$('.vc_tta-tab, .vc_tta-panel').removeClass('vc_active'); // Activate the clicked tab
$tabLink.parent('.vc_tta-tab').addClass('vc_active');
$(hash).addClass('vc_active'); // Scroll to the tab if needed
$('html, body').animate({ scrollTop: $(hash).offset().top - 100 }, 500);
}
}
});

🔹 Where to place it:

  • Inside Appearance → Customize → Additional CSS/JS → Custom JS
  • OR inside your theme’s footer before </body>
  • OR use a plugin like Simple Custom CSS and JS or Code Snippets.

Option 2: Use vc_tta-tabs built-in JS trigger

If the above doesn’t fully work, you can call VC’s native API after the tab init:

jQuery(window).on('load', function() {
var hash = window.location.hash;
if (hash && jQuery('a[href="' + hash + '"]').length) {
jQuery('a[href="' + hash + '"]').trigger('click');
}
});

This forces VC’s own event system to “click” the correct tab after the page fully loads.


Option 3: Fix links manually (if you can edit them)

Instead of #phponline, use the VC format:

https://phponline.in/keys/#vc_tta-tab-<ID>

…but this is usually less reliable because IDs can change when you edit the page.


Extra Tip

If you use caching or minification (like WP Rocket or Autoptimize), ensure the script isn’t deferred — otherwise, it might run before VC tabs finish initializing.

Related Article
Learn How to Fix WordPress Search Not Working (3+ Major Issues Resolved)

Are you looking to solve WordPress search issues on your website? Troubleshooting WordPress search issues may be difficult. This is Read more

How to Fix WordPress\’s White Screen of Death issue

Don\'t be alarmed if you get a WordPress error message or a white screen. Someone has most certainly seen the Read more

WordPress Installation

WordPress Installation Procedures Get the package at http://www.wordpress.org. Open your root web server and install WordPress. When you extract it, Read more

How to Customize WordPress Site

Customize Your WordPress Site Navigate to http://localhost/thedemostore/wp - admin. You should get something like this: admin is the user name. Read more

About WordPress Post

What exactly is a WordPress Post? How to Create and Update a WordPress Post? A CMS can have various types Read more

Image Shared on WordPress to Facebook Not Coming Up? Here\’s what to do.

  When you share your blog posts or web pages on Facebook, the picture might not show up the way Read more

What are WordPress wp_head & wp_footer functions

The wp_head and wp_footer methods are two important things to add to a WordPress theme. \"Action hooks\" are used to Read more

How to fix There was an error trying to send your message. Please try again later.

You make contact forms to make it easy for your audience to get in touch with you. Whether you use Read more

Comments

No comments yet. Why don’t you start the discussion?

    Leave a Reply

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

    Prove your humanity: 4   +   4   =