AdvancedCustomFields / AdvancedCustomFields/acf

Custom Taxonomy metabox information not saved properly

Open
#977 0 comments 0 reactions 0 assignees View on GitHub

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:

  1. Go to custom post
  2. Select custom taxonomies from standard wordpress metabox (select multiple)
  3. Click save post
  4. 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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.