Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only hierarchical custom taxonomies can be added to primary term taxonomies #21640

Open
2 tasks done
matthewmcvickar opened this issue Sep 13, 2024 · 0 comments
Open
2 tasks done

Comments

@matthewmcvickar
Copy link

  • I've read and understood the contribution guidelines.
  • I've searched for any related issues and avoided creating a duplicate issue.

Please give us a description of what happened

I was using the get_primary_term_taxonomies filter to add two custom taxonomies to the taxonomies that can have a primary category (per the documentation, but it was not working. After looking into the source code, I discovered that the taxonomies that can have primary terms are being filtered to exclude non-hierarchical taxonomies.

Why do these taxonomies have to be hierarchical? Could this filter be removed from the Primary_Term_Helper class and the generate_primary_term_taxonomies function?

(I was able to work around this problem by changing my taxonomies to 'hierarchical' => true, but I don't want them to be hierarchical.)

To Reproduce

Step-by-step reproduction instructions

  1. Create a custom taxonomy with the attribute 'hierarchical' => false.
  2. Use the wpseo_primary_term_taxonomies filter to add the 'primary term' feature to your custom taxonomy.
  3. Notice that the feature does not appear when multiple terms in that taxonomy are selected in the post editor.

Expected results

  1. A primary term can be selected for a custom taxonomy.

Actual results

  1. No primary term can be set for a custom taxonomy.

Screenshots, screen recording, code snippet

n/a

Technical info

  • If relevant, which editor is affected (or editors): n/a
  • Which browser is affected (or browsers): n/a

Used versions

  • Device you are using: n/a
  • Operating system: n/a
  • PHP version: 8.2
  • WordPress version: 6.6.2
  • WordPress Theme: [custom theme]
  • Yoast SEO version: 23.4
  • Relevant plugins in case of a bug: n/a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant