diff --git a/assets/js/shared-ui/select2.js b/assets/js/shared-ui/select2.js
index 2e989f8e..d9597013 100644
--- a/assets/js/shared-ui/select2.js
+++ b/assets/js/shared-ui/select2.js
@@ -156,6 +156,27 @@
};
+ SUI.select.formatSearchOptions = ( data, container ) => {
+
+ let markup;
+
+ const label = SUI.select.escapeJS( data.text );
+ const url = $( data.element ).attr( 'data-url' );
+
+ if ( ! data.id ) {
+ return label; // optgroup.
+ }
+
+ if ( 'undefined' !== typeof url ) {
+ markup = '' + label + '' + url + ' ';
+ } else {
+ markup = label;
+ }
+
+ return markup;
+
+ };
+
SUI.select.formatVarsSelection = ( data, container ) => {
let markup;
@@ -235,6 +256,10 @@
dropdownParent: selectParent,
minimumInputLength: 2,
maximumSelectionLength: 1,
+ templateResult: SUI.select.formatSearchOptions,
+ escapeMarkup: function( markup ) {
+ return markup;
+ },
dropdownCssClass: isSmall
});
};