WordPress.org

Ready to get started?Download WordPress

Forums

get_the_category() is STILL broken... (3 posts)

  1. palamedes
    Member
    Posted 6 years ago #

    The template function "get_the_category" is still broken and has been for a while -- let me explain, please refer to my blog category here:

    http://info.rsow.com/category/rants/?example

    Adding ?example to the end of the URL will give a print_r of get_the_category() for now.

    Note: My posts per page is set to 6.

    Rants! has 27 posts in it, and 2 sub-categories Comedy with 1 post and Experiences with 2 posts. This means the parent category (Rants!) has 30 posts and the side bar menu widget "Categories" correctly shows that number.

    However, get_the_category says it only has a count of 27

    More over, if you go to page 3 (http://info.rsow.com/category/rants/page/3/?example) suddenly get_the_category is ALL wrong.. It delivers the information for the "Experiences" category, not the "Rants!" category.

    I'm NOT referencing it in the loop but its acting like I am.

    On page three of the category "Rants!" the first entry is one that is from "Experiences" so its likely an error around that.

    Do you agree or disagree this is a bug?

    Note; Previously "get_the_categories" had the same (and worse) bugs -- its still not fixed.

  2. iridiax
    Member
    Posted 6 years ago #

    This tag must be used within the loop and returns an array of each category assigned to a post. I'm not sure that this tag is meant to do what you want, so why not try a different category tag?

  3. palamedes
    Member
    Posted 6 years ago #

    Okay then, I'm using it incorrectly.

    Which brings me to my next point.. (and I'm disabling the ?example stuff now)

    if you're at this url;

    http://info.rsow.com/category/rants/

    How do you get the correct category information OUTSIDE the loop? I mean it must be available.. the category slug is rants, it says so right there in the url... I want the rants category information to be available to me outside the loop..

    Am I forced to write my own call here?

Topic Closed

This topic has been closed to new replies.

About this Topic