Title: [Plugin: Advanced Custom Fields] Get field without spaces and characters
Last modified: August 30, 2016

---

# [Plugin: Advanced Custom Fields] Get field without spaces and characters

 *  Resolved [daelemans_m](https://wordpress.org/support/users/daelemans_m/)
 * (@daelemans_m)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/plugin-advanced-custom-fields-1/)
 * Hello
 * Is there a way to get a field without spaces and characters (colons, commas, …)?
   I want to use the field in my CSS.
 * Example: the field content is “10:00 – 18:00” and I want to get it as “1000-1800”.
 * Thanks!
 * Matthias

Viewing 1 replies (of 1 total)

 *  Thread Starter [daelemans_m](https://wordpress.org/support/users/daelemans_m/)
 * (@daelemans_m)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/plugin-advanced-custom-fields-1/#post-6294199)
 * I found a code which works partially:
 * `<?php $a = array(':',' - '); $b = array('',''); $str = '10:00 - 18:00'; echo
   str_replace($a, $b, $str); ?>`
 * That code displays _10001800_.
 * But I have to do this multiple times with different hours (see `$str`) and I 
   don’t want to change the `$str` each time. When I replace the `'10:00 - 18:00';`
   with `the_field("dag-2");` (which equals to _10:00 – 18:00_), it displays the
   field but it replaces nothing.
 * Someone please? 🙂

Viewing 1 replies (of 1 total)

The topic ‘[Plugin: Advanced Custom Fields] Get field without spaces and characters’
is closed to new replies.

## Tags

 * [comma](https://wordpress.org/support/topic-tag/comma/)
 * [custom](https://wordpress.org/support/topic-tag/custom/)
 * [custom fields](https://wordpress.org/support/topic-tag/custom-fields/)
 * [field](https://wordpress.org/support/topic-tag/field/)
 * [hours](https://wordpress.org/support/topic-tag/hours/)
 * [spaces](https://wordpress.org/support/topic-tag/spaces/)
 * [string](https://wordpress.org/support/topic-tag/string/)

 * 1 reply
 * 1 participant
 * Last reply from: [daelemans_m](https://wordpress.org/support/users/daelemans_m/)
 * Last activity: [10 years, 10 months ago](https://wordpress.org/support/topic/plugin-advanced-custom-fields-1/#post-6294199)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
