Support

Account

Home Forums Backend Issues (wp-admin) Allow select2 fields to render HTML again Reply To: Allow select2 fields to render HTML again

  • This seems to work, we are using it for the admin area only.

    add_action(‘acf/input/admin_footer’, function() {
    if (!is_admin()) {
    return;
    }
    ?>
    <script>
    acf.add_filter(‘select2_args’, function(args) {
    args.templateSelection = function(selection) {
    var $selection = jQuery(‘<span class=”acf-selection”></span>’);
    $selection.html(acf.escHtml(selection.text));
    $selection.data(‘element’, selection.element);
    return $selection;
    }
    return args;
    });
    </script>
    <?php
    });