Title: strtolower (?)
Last modified: August 18, 2016

---

# strtolower (?)

 *  [kiddeath91](https://wordpress.org/support/users/kiddeath91/)
 * (@kiddeath91)
 * [20 years, 10 months ago](https://wordpress.org/support/topic/strtolower/)
 * Quick php question:
 * Trying to get my categories to print in lowercase in one instance. I’ve tried
   hacking `strtolower()` to this line of code in the theme templates:
 * `<?php the_category(', ') ?>`
 * but can’t get it to work. And I’m not sure if this is the right function to be
   using.
 * Any php gurus out there know the answer? If strtolower() will work, how would
   this look codewise with the above WP php call for the category? Unfortunately,
   CSS is not going to cut it as I need cats to be low caps even without styles 
   enabled.
 * Thanks.

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

 *  [skippy](https://wordpress.org/support/users/skippy/)
 * (@skippy)
 * [20 years, 10 months ago](https://wordpress.org/support/topic/strtolower/#post-229895)
 * [the_category()](http://codex.wordpress.org/Template_Tags/the_category) sends
   the name of the category directly to the browser, so you won’t be able to use`
   strtolower` on it.
 * You could try using [get_the_category()](http://codex.wordpress.org/Template_Tags/get_the_category),
   which will return to you an array of category objects. Then you could `echo strtolower(...);`
   each category name as needed.
 *  Thread Starter [kiddeath91](https://wordpress.org/support/users/kiddeath91/)
 * (@kiddeath91)
 * [20 years, 10 months ago](https://wordpress.org/support/topic/strtolower/#post-229911)
 * Thanks Skippy. I needed this to impact all categories so I went back to the source
   of `the_category()`. Here’s what I did:
 * I fixed it by hacking the templates-function-category.php file. If you capitalize
   your categories normally, but want them lowercase only on posts like me (mainly
   for tags) add this line to the file:
 *  `$category->cat_name = strtolower($category->cat_name);`
 * Around line 75 where you see these lines of code (hack is in bold):
 * ` foreach ($categories as $category) {
    $category->cat_name = $category->cat_name;
   
   **
   $category->cat_name = strtolower($category->cat_name);** if (0 < $i) $thelist.
   = $separator . ' ';
 * If this breaks something, I’ll post it back here. I checked it and so far everything
   seems ok. Hope this helps someone.
 *  [skippy](https://wordpress.org/support/users/skippy/)
 * (@skippy)
 * [20 years, 10 months ago](https://wordpress.org/support/topic/strtolower/#post-229912)
 * I generally discourage people from modifying the core WordPress files, as thet
   complicates upgrades.
 * I’m glad you were able to fix this for yourself.

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

The topic ‘strtolower (?)’ is closed to new replies.

## Tags

 * [lowercase](https://wordpress.org/support/topic-tag/lowercase/)
 * [php](https://wordpress.org/support/topic-tag/php/)
 * [strtolower](https://wordpress.org/support/topic-tag/strtolower/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 2 participants
 * Last reply from: [skippy](https://wordpress.org/support/users/skippy/)
 * Last activity: [20 years, 10 months ago](https://wordpress.org/support/topic/strtolower/#post-229912)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
