Template files not working for archives and categories

I added category-news.php template file to the theme directory but it doesn't apply the template of the category but instead to the index.php file.

category-slug.php is the highest level of the template heirarchy of WordPress so it should accept the file. I tried also category-id.php and it also doesn't work. The same for archives template files.

However, when I use single-slug.php or page-slug.php it's working without any problems.

I checked that there is not any conflicts with the permalinks, it's a parent category with the slug news and the class of the page of the category is category-news. What can cause this problem?

Topic template-hierarchy categories templates Wordpress

Category Web


I do not understand your question very much, but if it is a category the template file should be named for taxonomy-category-news.php or taxonomy-category_news.php

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.