Snippets: Alter Main Menu Location Via Hook

// Alter Main Menu Location Via Hook
function my_wpex_main_menu_location( $location ) {
	
	// Display "woocommerce" menu location for woocommerce pages
	if ( function_exists( 'is_woocommerce' ) && is_woocommerce() ) {
		return 'woocommerce';
	}

	// Return location
	return $location;

}
add_filter( 'wpex_main_menu_location', 'my_wpex_main_menu_location' );

Snippet Type: PHP

Posted Under: Menu

All PHP snippets should be added via a child theme's functions.php file.