Title: using underscores in %postname%
Last modified: August 18, 2016

---

# using underscores in %postname%

 *  [Liz](https://wordpress.org/support/users/liz/)
 * (@liz)
 * [22 years, 1 month ago](https://wordpress.org/support/topic/using-underscores-in-postname/)
 * Is there any way to modify the code so that %postname% uses underscores rather
   than dashes? I’d rather not have to deal with mod_rewrite or redirects if I don’t
   have to–seems like it makes more sense to modify the code itself to simply use
   underscores.
    I’m not a PHP wizard, but I’m competent with it…I’m just not sure
   where to find the escape function that’s apparently being used. Thanks…

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

 *  [carthik](https://wordpress.org/support/users/carthik/)
 * (@carthik)
 * [22 years, 1 month ago](https://wordpress.org/support/topic/using-underscores-in-postname/#post-51999)
 * There is a function called sanitize_title. That can be modified to do what you
   want done.
    – is better than _ , as far as google and some other search engines
   are considered, cause they properly seperate words. Moving over to the – style
   might be better for you in the bigger scheme of things.
 *  Thread Starter [Liz](https://wordpress.org/support/users/liz/)
 * (@liz)
 * [22 years, 1 month ago](https://wordpress.org/support/topic/using-underscores-in-postname/#post-52004)
 * Thanks for the quick response!
    I’ve debated that a bit. I may eventually shift
   over to dashes (and lose the .php extension I now use), but I feel like there’s
   enough change in my blogging world right now and the underscores provide some
   sense of continuity. And since I haven’t had much trouble with Google finding
   my posts up ’til now (the full post name is still in the post itself…), I’m not
   too worried.
 *  [carthik](https://wordpress.org/support/users/carthik/)
 * (@carthik)
 * [22 years, 1 month ago](https://wordpress.org/support/topic/using-underscores-in-postname/#post-52006)
 * Okay Kiz, the function sanitize_title() is in wp-includes/functions-formatting.
   php
    you’ll need to change these line there… ` 85 $title = str_replace(' ', '-',
   $title); 86 $title = preg_replace('|-+|', '-', $title);  changing ‘-‘ to ‘_’

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

The topic ‘using underscores in %postname%’ is closed to new replies.

 * In: [Installing WordPress](https://wordpress.org/support/forum/installation/)
 * 3 replies
 * 2 participants
 * Last reply from: [carthik](https://wordpress.org/support/users/carthik/)
 * Last activity: [22 years, 1 month ago](https://wordpress.org/support/topic/using-underscores-in-postname/#post-52006)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
