skip to Main Content

Disable WPBakery Accordion URL Hash Change

You may want to consider using the Themes "Toggle" and "Toggle Group" elements instead of the WPBakery Accordion which are much cleaner and modern.

By default when using the WPBakery Accordion element whenever you click on a new item it will change the URL in the browser, the following snippet removes that functionality and prevents the URL hash change.

 * Disables the WPBakery Accordion element URL hash change.
 * @link
add_action( 'wp_footer', function() {
	jQuery( function() {
		if ( jQuery.fn.vcAccordion && jQuery.fn.vcAccordion.Constructor) {
			jQuery.fn.vcAccordion.Constructor.prototype.changeLocationHash = function() {};
	} );
All PHP snippets should be added via child theme's functions.php file or via a plugin (we recommend Code Snippets)
Back To Top