Home › Forums › Bug Reports › Special Character Codes in Post Titles showing in Post Object field › Reply To: Special Character Codes in Post Titles showing in Post Object field
@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');
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.