I figured a way to do this by fumbling my way through the concept of PHP closures.
I created a pull request which you can see here.
Thanks John, super useful!
Thanks John, I don’t want to hijack this thread, but I fixed the issue by using the field key rather than the name to access the relationship field contents; then all was back to normal.
I probably have a naming collision somewhere, although its strange that I didnt see this behaviour before the 5.6 update.
Thanks for the pointers nonetheless!
Sorry, I was in a rush when reporting the above – I should have mentioned that the issue started after upgrading to ACF 5.6
I have since worked around it by using the field key to access the field contents rather than the name. Using the name would return IDs regardless of the setting in the field group edit page.
I probably have a naming collision somewhere, at least, that is the only conclusion I can find.
Im having the same issue on relationship fields, but in reverse – they now only return IDs!
For anyone looking, select2 has changed maximumSelectionSize
to maximumSelectionLength
. An updated version of the above:
(function($) {
acf.add_filter('select2_args', function( args, $select, settings ){
// limit to 3
args.maximumSelectionLength = 3;
return args;
});
})(jQuery);
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.