You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've spent some time debugging this issue. I've discovered that when you have multiple taxonomies with one-or-more terms that share the same "name" (or title or label or whatever), the rendered Taxonomy Term picker will erroneously show the "term options" for each same-named term in each optgroup.
Clear as mud? This is the configuration:
Select Type = Term
Output type = ID
Also assume I have the following taxonomies & terms in a WP site:
Taxonomy: Category
Term: travel
Term: nightlife
Term: other
Taxonomy: Sizes
Term: small
Term: medium
Term: large
Term: other
In file acf-taxonomy-chooser-v5.php around line 312 you loop over all terms in wordpress. For each term you check if it's "name" matches a list of Admin-selected terms. If so, add it to the list. But since you're looping over ALL terms, you will end adding "other" twice, since it gets checked twice (and the check passes both times).
The plugin should find the IDs of the terms some other way. Probably build a look-up array earlier in the function that simply maps the ACF "parent-tax-slug:term-slug" to the ID. I might just do that and submit a pull request.
You also do a regex on line 308 to strip out a beginning "-" character with any space. I'm not sure this makes sense, since category names don't actually have a hyphen before them? Unless I'm missing something. Anyway, the way the regex is written, it removes all dashes.
The text was updated successfully, but these errors were encountered:
I've spent some time debugging this issue. I've discovered that when you have multiple taxonomies with one-or-more terms that share the same "name" (or title or label or whatever), the rendered Taxonomy Term picker will erroneously show the "term options" for each same-named term in each optgroup.
Clear as mud? This is the configuration:
Select Type = Term
Output type = ID
Also assume I have the following taxonomies & terms in a WP site:
Taxonomy: Category
Term: travel
Term: nightlife
Term: other
Taxonomy: Sizes
Term: small
Term: medium
Term: large
Term: other
In file
acf-taxonomy-chooser-v5.php
around line 312 you loop over all terms in wordpress. For each term you check if it's "name" matches a list of Admin-selected terms. If so, add it to the list. But since you're looping over ALL terms, you will end adding "other" twice, since it gets checked twice (and the check passes both times).The plugin should find the IDs of the terms some other way. Probably build a look-up array earlier in the function that simply maps the ACF "parent-tax-slug:term-slug" to the ID. I might just do that and submit a pull request.
You also do a regex on line 308 to strip out a beginning "-" character with any space. I'm not sure this makes sense, since category names don't actually have a hyphen before them? Unless I'm missing something. Anyway, the way the regex is written, it removes all dashes.
The text was updated successfully, but these errors were encountered: