Wordpress permalink custom structure not working on subcategories

63 views Asked by At

I am working on a Wordpress theme for a portfolio website. I have a bunch of posts that are projects that have a category of 'projects' but also subcategories like 'video' or 'photography'. I have an archive page for the category of 'projects' that displays all the 'projects' posts and, on this page, I also have a directory with the list of all the subcategories under 'projects' that I want to link to each respective subcategory archive page.

Everything was working great, until I edited the permalink structure.

I would like for the 'projects' archive page permalink to look like the following: domain.com/projects/

To do this, I used a custom structure of /%category%/%postname%/ and, on the category base I wrote . (a dot), to hide 'category' from the permalink (otherwise it would lool like: domain.com/category/projects/). So, now the subcategories' links don't work, because the subcategory permalink is: domain.com/subcategory/ but the directory of subcategories under 'projects' link to: domain.com/projects/subcategories/

Any ideas on how to either change the subcategories permalinks or the actual links on the directory of subcategories?

Additional context:
I am calling this list of subcategories like this:

<?php
$category = get_category_by_slug( 'projects' );
wp_list_categories('child_of='.$category->term_id);
?>
0

There are 0 answers