Home › Forums › General Issues › Strip whitespace from custom field › Reply To: Strip whitespace from custom field
There are a few this missing with your above code:
1. You need to echo the str_replace returned value
2. Please use get_field
instead of the_field
when returning data to a function
3. Please use the $find and $replace parameters in the str_replace function.
Your code should look more like this:
<?php echo str_replace(' ', '', get_field('box_office', 'option')); ?>
Thanks
E
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.