Title: Replace Underscore with Blank Space
Last modified: January 13, 2017

---

# Replace Underscore with Blank Space

 *  [sdesigns](https://wordpress.org/support/users/sdesigns/)
 * (@sdesigns)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/replace-underscore-with-blank-space-2/)
 * I am echoing a post meta key with the name property_type and this is outputting
   with underscores between the words. I am trying to remove these underscores using
   str_replace but I must have something wrong in my code as it is still putting
   the underscores in.
 * `<?php $key="property_type"; echo get_post_meta($post->ID, $key, true ); $key
   = str_replace('_', ' ', $key);?>`
 * Any help would be great.

Viewing 1 replies (of 1 total)

 *  Moderator [t-p](https://wordpress.org/support/users/t-p/)
 * (@t-p)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/replace-underscore-with-blank-space-2/#post-8649397)
 * See if this points you in the right direction:
 * [http://stackoverflow.com/questions/5356133/how-to-replace-underscores-with-spaces-using-a-regex-in-javascript](http://stackoverflow.com/questions/5356133/how-to-replace-underscores-with-spaces-using-a-regex-in-javascript)
 * [http://stackoverflow.com/questions/29405786/replace-underscore-with-space-and-upper-case-first-character-in-array](http://stackoverflow.com/questions/29405786/replace-underscore-with-space-and-upper-case-first-character-in-array)
    -  This reply was modified 9 years, 5 months ago by [t-p](https://wordpress.org/support/users/t-p/).

Viewing 1 replies (of 1 total)

The topic ‘Replace Underscore with Blank Space’ is closed to new replies.

## Tags

 * [str_replace](https://wordpress.org/support/topic-tag/str_replace/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [t-p](https://wordpress.org/support/users/t-p/)
 * Last activity: [9 years, 5 months ago](https://wordpress.org/support/topic/replace-underscore-with-blank-space-2/#post-8649397)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
