Disable ShiftNav on a specific page (or any custom condition)

ShiftNav is added to your site via the wp_footer hook, so removing it is as simple as unhooking that action.

This is the PHP that will remove the main ShiftNav instance:

remove_action( 'wp_footer', 'shiftnav_direct_injection' );

To target a specific page, you’ll generally want to test for that page conditionally. In the following example, ShiftNav would be removed from page 1380:

add_action( 'wp_head' , 'remove_shiftnav' );
function remove_shiftnav(){
	if( is_page( 1380 ) ){
		remove_action( 'wp_footer', 'shiftnav_direct_injection' );
	}
}

You can tailor the condition to your specific needs. Here’s a list of WordPress Conditional Tags

Generally, this code works best in a child theme’s functions.php file

Removing styles and scripts

To remove ShiftNav’s CSS and JS assets, you can use

add_action( 'wp' , 'remove_shiftnav_assets' );
function remove_shiftnav_assets(){
	if( is_page( 1380 ) ){
		remove_action( 'wp_enqueue_scripts' , 'shiftnav_load_assets' , 101 );
		remove_action( 'wp_enqueue_scripts' , 'shiftnav_pro_load_assets' , 20 );
		remove_action( 'wp_head' , 'shiftnav_inject_css' );
	}
}

On this page