Hi RichardU, the content of my reply was a suggestion for further plugin development. The suggested button is not currently available.
Thank you, Bettylex! To make it perfect, the plugin can be extended to appear as a button in each post’s edit page. Then, after clicking the button, the plugin will cross-check the custom fields that currently appear in the post edit page against the custom fields that are associated to the post in the database – resulting in a list of unused database custom fields that can be safely deleted.
Update: I’ve found the cause of the issue.
I had a filter function attached to the “script_loader_tag” hook that adds a “defer” attribute to all of the JS script tags. The filtering wasn’t limited to the frontend only and somehow interfered with ACF’s process of loading JS files in the backend.
Once the filter has been limited to the frontend only, ACF’s functionality in the backend returned to normal.
Thanks for your time John!
John first of all: Thank you very much for the quick support, you helped me understand the factors of the issue.
I hope Elliot will read this thread & descide to enable selection of the same value multiple times. It can dramatically improve data editing, proccessing & loading time efficiency in some cases.
P.S:
I’ve experimented with “hard replacing” the .js files of select2 in ACF with version 4 & it allows the multiple selection right out the box! But I didn’t risk saving because compatability must be made by ACF’s developer.
Wow! Thank you John, it seems that a new version of select2 supports this need.
Do you know how I can update the select2 version used by acf?
Thank you for the quick reply John.
1. There is no web-standard prevention of having the same value for multiple options in a select field – it is a common use case.
2. In the “real” end, a post object field is just an array (not a select field), no prevention for the same value repating more than once here either.
3. From my understanding (pretty sure about this), each time you begin to add an item to the post object field the wp_query re-runs. Each re-run gives all of the options regardless of what was selected before. And it is a specific JS script that forcibly removes options that were selected before.
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.