Add current menu on navigation block based on url using javascript
in this case I used are kadence theme element to create navigation block to display on archive page based on url, in default navigation block don’t have a class current menu, so I tried to find a way and found this article and it worked
resources: github
add_action( 'wp_footer', function() { ?> <script> document.body.querySelectorAll( '.wp-block-navigation' ).forEach( function( navBlock ) { navBlock.querySelectorAll( '[href="' + window.location.href + '"]' ).forEach( function( navActiveLink ) { navActiveLink.parentNode.classList.add( 'active-nav-item' ); }); }); </script> <?php } );Download Here