Support

Account

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');