• I’m not sure if this is a bug but there’s something weird going on here. I’ve been struggling to figure out why single_cat_title or wp_title won’t work inside an is_category query inside a functions.php function, then I checked the contents of query variable and turns out is_category is null even if there’s a value for the category name and such.

    [comments] =>
        [comment_count] => 0
        [current_comment] => -1
        [comment] =>
        [found_posts] => 2
        [max_num_pages] => 1
        [max_num_comment_pages] => 0
        [is_single] =>
        [is_preview] =>
        [is_page] =>
        [is_archive] =>
        [is_date] =>
        [is_year] =>
        [is_month] =>
        [is_day] =>
        [is_time] =>
        [is_author] =>
        [is_category] =>
        [is_tag] =>
        [is_tax] =>
        [is_search] =>
        [is_feed] =>
        [is_comment_feed] =>
        [is_trackback] =>
        [is_home] =>
        [is_404] => 1
        [is_comments_popup] =>
        [is_admin] =>
        [is_attachment] =>
        [is_singular] =>
        [is_robots] =>
        [is_posts_page] =>
        [is_paged] =>
        [query] => Array
            (
                [category_name] => news
                [taxonomy] => category
                [term] => news
            )

    queried_object is also null.

    Depending on the category archive I browse, sometimes is_archive is true (1), sometimes it isn’t. Sometimes the body_class also turns up a 404 error.

    What could be the possible cause for this? Plugins? Permalinks? All of the above?

Viewing 2 replies - 1 through 2 (of 2 total)
  • You might consider using the in_category() function in place of the is_category() function.

    Thread Starter s

    (@sofimi)

    Thanks. I’m not sure that would work though if you just want to know if it’s a category archive with no particular category in mind. What weirded me out is it does know it’s an archive, it just doesn’t know what kind. Seems there was a conflict with Query Multiple Taxonomies plugin. But another problem’s cropped up having to do with custom taxonomies and custom post types but that’s another issue I guess with permalink flushing which doesn’t seem to solve it.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Category archive, but is_category is false’ is closed to new replies.