I have a header.php, that appears in every single page on my blog, with a navbar that looks like this:
<nav> <ul> <li><a href="<?php echo get_permalink(4); ?>">Logistics</a></li> <li><a href="<?php echo get_permalink(5); ?>#contact">Contact</a></li> </ul> </nav>
But when I click the anchor tag linking to #contact, which is located in page with id 5, as you can see by the php code, nothing happens. I tried using a slash (/#contact) but I keep getting the same behavior. Isn’t this the correct way of linking to a specific id on another page?
Read more here: Linking to specific ID on another WordPress page?