Title: Category count wrong
Last modified: June 14, 2019

---

# Category count wrong

 *  Resolved [Stephen S](https://wordpress.org/support/users/ssuess/)
 * (@ssuess)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/category-count-wrong/)
 * Your code was not returning a correct category count on the category page. I 
   have changed your code to fix it.
 * Here is your original code:
 *     ```
       $travelera_cat = get_the_category();
       $travelera_cat = $travelera_cat[0];
       $travelera_cat_count = $travelera_cat->category_count;
       printf( _n( '%s Article', '%s Articles', intval( $travelera_cat_count ), 'travelera-lite' ), intval( $travelera_cat_count ) );
       ```
   
 * And here is code that works:
 *     ```
       $idObj = get_category_by_slug(single_cat_title( '', false )); 
        $thisid = $idObj->term_id;
        $travelera_cat = get_category($thisid);
        $travelera_cat_count = $travelera_cat->count;
        printf( _n( '%s Article', '%s Articles', intval( $travelera_cat_count ), 'travelera-lite' ), intval( $travelera_cat_count ) );
       ```
   

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

 *  Theme Author [BloomPixel](https://wordpress.org/support/users/bloompixel/)
 * (@bloompixel)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/category-count-wrong/#post-11637157)
 * Hi Stephen
 * Thank you for reporting the issue and also for providing the fix. I have just
   pushed an update for the same.
 * Thank you
 *  Thread Starter [Stephen S](https://wordpress.org/support/users/ssuess/)
 * (@ssuess)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/category-count-wrong/#post-11637163)
 * You are very welcome, thanks for the excellent theme. 🙂
 *  Theme Author [BloomPixel](https://wordpress.org/support/users/bloompixel/)
 * (@bloompixel)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/category-count-wrong/#post-11637187)
 * Hi Stephen
 * If you’re happy with the theme, please help by rating 5 stars and leave an awesome
   feedback.
 * Thank you

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

The topic ‘Category count wrong’ is closed to new replies.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/travelera-lite/1.0.1.7/screenshot.
   png)
 * Travelera Lite
 * [Support Threads](https://wordpress.org/support/theme/travelera-lite/)
 * [Active Topics](https://wordpress.org/support/theme/travelera-lite/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/travelera-lite/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/travelera-lite/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [BloomPixel](https://wordpress.org/support/users/bloompixel/)
 * Last activity: [6 years, 9 months ago](https://wordpress.org/support/topic/category-count-wrong/#post-11637187)
 * Status: resolved