Support

Account

Home Forums ACF PRO Sorting Selected Relationship Values in Admin Reply To: Sorting Selected Relationship Values in Admin

  • Sadly not possible from ACF itself.
    But with some creative jQuery it is certainly possible;

    $('.acf-relationship .selection .values ul.acf-bl.list.values-list').each(function () {
        var mylist = $(this);
        var listitems = mylist.children('li').get();
        listitems.sort(function (a, b) {
            return $(a).text().toUpperCase().localeCompare($(b).text().toUpperCase());
        })
        
        $.each(listitems, function (idx, itm) {
            var txt = $(this).text();
                mylist.append(itm);
        });
    });

    Enjoy!