I have recently faced multiple issues with a theme developed with in mind pretty permalinks when moving back to ugly ones (for a number of different reasons). Had issues that I resolved with categories and tags as displayed on my sidebar and also now have the same issue with categories in a custom navigation menu.
Originally, the below code would take me to all the posts whose category is called ‘Amazing’, currently with the use of ugly permalinks (to which I need to stick now for a bunch of reasons) I am returned with a 404 error message. Here is an excerpt of my navigation:
<nav class="my-nav-menu"> <div class="myclass"> <ul role="navigation" class="mymenuentries"> <li class="col-clas"> <a class="myotherclass" href="<?php echo home_url() ?>/category/Amazing">AmazingCategory</a> </li> </ul> </div> </nav>
The code will generate this URL:
that returns a 404 message, whereas I know that the following will return all the posts associated to that category:
How can I dynamically make sure that the category is fetched by its ID? I am also very much not aware how that piece of code was actually working with pretty permalinks. Can you help?