WordPress change wp_nav_menu walker with a custom one
In general you’d add child substitutions for the relevant templates if possible, as Tom mentions in the comments. Alternately, you can use a wp_nav_menu_args filter hook to swap in your own arguments prior to WordPress retrieving and rendering the menu: add_filter( ‘wp_get_nav_menu_args’, ‘wpse406010_primary_nav_menu_args’ ); function wpse406010_primary_nav_menu_args( $args ) { if( $args[ ‘theme_location’ ] !== ‘primary’ … Read more