AdvancedCustomFields / AdvancedCustomFields/acf
Custom Taxonomy metabox information not saved properly
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 945
- Forks
- 197
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
When having a custom post type taxonomy (hierarchical) when saving a custom post with ACF enabled the taxonomies are not saved all but only 1 selection.
To Reproduce
Steps to reproduce the behavior:
- Go to custom post
- Select custom taxonomies from standard wordpress metabox (select multiple)
- Click save post
- See only 1 taxonomy saved
Expected behavior
All taxonomies should be assigned to a post
Code
The following line seems to be the problem
plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-taxonomy.php:414
Changing the following line
from
wp_set_object_terms( $id, $term_ids, $taxonomy, false );
to
wp_set_object_terms( $id, $term_ids, $taxonomy, true ); seems to solve the problem
Version Information:
- WordPress Version 6.8.2
- PHP Version 8.3
- ACF Version ACF PRO 6.5.1
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-taxonomy.php at line 414 and reproduce the issue using a hierarchical custom post type taxonomy. Verify whether selecting multiple terms in the standard WordPress metabox preserves all selections after saving; done means all selected taxonomies remain assigned to the post.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 58/100