skip to Main Content

Disable URL Hash Update For Local Scroll Links

Important: This functionality is actually disabled by default and you no longer need to use code because you can now control this via the Customizer under General Theme Options > Local Scroll Links

The following snippet can be used to disable the URL hash change when clicking local scroll links.

/**
 * Disable URL Hash Update For Local Scroll Links.
 *
 * @link https://total.wpexplorer.com/docs/snippets/disable-url-hash-update-for-local-scroll-links/
 */
function myprefix_disable_local_scroll_hash_update( $array ) {
	$array['localScrollUpdateHash'] = false;
	return $array;
}
add_filter( 'wpex_localize_array', 'myprefix_disable_local_scroll_hash_update' );
All PHP snippets should be added via child theme's functions.php file or via the Code Snippets Plugin (or alternative plugin)
Back To Top