@@ -133,12 +133,13 @@ function get_ajax_query( $options = [] ) {
133133 /**
134134 * This function returns the value label for the input element on the admin side.
135135 *
136- * @param \WP_Term $term The term object.
137- * @param array $field The field settings.
138- * @param int $post_id The post_id to which this value is saved to
136+ * @param \WP_Term $term The term object.
137+ * @param array $field The field settings.
138+ * @param int $post_id The post_id to which this value is saved to
139+ * @param boolean $unescape Should we return an unescaped post title.
139140 * @return string
140141 */
141- function get_term_title ( $ term , $ field , $ post_id = 0 ) {
142+ function get_term_title ( $ term , $ field , $ post_id = 0 , $ unescape = false ) {
142143
143144 // get post_id
144145 if ( ! $ post_id ) {
@@ -160,6 +161,11 @@ function get_term_title( $term, $field, $post_id = 0 ) {
160161 // title
161162 $ title .= $ term ->name ;
162163
164+ // unescape for select2 output which handles the escaping.
165+ if ( $ unescape ) {
166+ $ title = html_entity_decode ( $ title );
167+ }
168+
163169 // filters
164170 $ title = apply_filters ( 'acf/fields/taxonomy/result ' , $ title , $ term , $ field , $ post_id );
165171 $ title = apply_filters ( 'acf/fields/taxonomy/result/name= ' . $ field ['_name ' ], $ title , $ term , $ field , $ post_id );
@@ -508,7 +514,7 @@ function start_el( &$output, $term, $depth = 0, $args = [], $current_object_id =
508514
509515 foreach ( $ field ['taxonomy ' ] as $ taxonomy ) {
510516 // taxonomy
511- $ taxonomy_obj = get_taxonomy ( $ taxonomy );
517+ $ taxonomy_obj = get_taxonomy ( $ taxonomy );
512518
513519 // vars
514520 $ args = [
0 commit comments