get_the_category() is hit and miss when using sub-categories.
-
There is a real issue with categories in WP.
Basically I am listing posts by region. So I have ‘UK’ as top level, then Scotland, North East, North West, etc. as sub-categories.When categorising posts I tick ‘UK’ and ‘Scotland’. This sometimes works and ‘the_category()’ displays as ‘UK > Scotland’. However sometimes it will say ‘Scotland > UK’.
Then when trying to use ‘get_the_category()’ of the archive page I am on it will return either ‘UK’, or ‘Scotland’ depending on how the posts in that archive have their category logged. So despite being on ‘Scotland’, ‘get_the_category()’ returns ‘UK’.There doesn’t appear to be a work around, and I think it’s a bug in WP that needs fixing urgently. Categorisation is an important part of a blog, and especially when attempting to use WP as a CMS.
- The topic ‘get_the_category() is hit and miss when using sub-categories.’ is closed to new replies.