Field values are ending up with slashes in front of certain characters

Created by Phil Kurth, Modified on Tue, 28 Jun, 2022 at 4:41 PM by Phil Kurth

If you find values to be slashed — e.g; that's > that\'s — then you may need to hook into ACF's field value formatting and reformat the value as follows: 

add_filter( 'acf/format_value/type=text', function ( $value ) {
  return stripslashes( $value );
}, 10, 1 );

Note that the above example handles text fields only. If you also need to handle textarea fields:

add_filter( 'acf/format_value/type=textarea', function ( $value ) {
  return stripslashes( $value );
}, 10, 1 );

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article