I’m using a Post Object field in the back end of a client website and just recently it has been showing any special characters in Post Titles, in our case dashes ( – ), as the character code – instead of the dash.
We’ve been using these fields in this website for years without this happening, so this is a new issue, perhaps introduced in a recent either WP or ACF update. Is there a workaround or a patch coming?
Thanks.
To add another detail, the existing value in the field, set prior to this issue arising, shows the dashes normally. But if I replace it with the same Post from the dropdown post list, it shows the #8211 code.
@ceebeez have you had any successes with work arounds? I am having the same issue. I have tried implementing the following function but with no positive outcome.
function escape_acf_field_titles($field) {
if ($field['type'] == 'post_object' && isset($field['choices'])) {
$escaped_choices = array();
foreach ($field['choices'] as $post_id => $post_title) {
$post_title = get_the_title($post_id);
$escaped_choices[$post_id] = esc_html($post_title);
}
$field['choices'] = $escaped_choices;
}
return $field;
}
add_filter('acf/load_field', 'escape_acf_field_titles');