WordPress.org

Ideas

Singular Taxonomy Term Per Post

  1. alpha1beta
    Inactive

    12345

    I have an idea for taxonomies - an additional argument set while registering a taxonomy is_singular (bool) Defaults to false - that would force only one taxonomy term to ever be attached to a single post.

    In many cases, a developer may want to set up a taxonomy, which each term can only be used once per post, and needs to be enforced on the front end to the users.
    Some user cases:
    - allow for custom post stati for a custom post type to be managed in the backend
    - allow for using a taxonomy terms for a single picklist, this could be used for many things - a lead status field for a CRM, menu item categories for a menu item custom post type.
    - applying a single job title or company taxonomy to a user account
    - allows the use of categories or a custom post type to be better used in a creating the permalink. A post with multiple categories will pick the first one if categories are used in a permalink - but with a singular taxonomy, a new taxonomy could be set in the permalink structure, categories could still be used for related posts, but the new taxonomy can be dedicated to creating the url and menu verticals.

    An additional argument could be made to allow saving the term name as text in the the post meta field, instead of linking the post to the taxonomy.

    is_singular would:
    - set the taxonomy metabox to a dropdown (or radio?), instead of checkboxes
    - force wp_set_object_terms $append to false (not overridable)

    Posted: 2 years ago #
  2. Saugroboter
    Member

    12345

    I like the idea. I think it would make work a bit easier. Moreover, it makes the structure of your website a bit more logical. It would be also quite useful to be able to save the term name in the meta field.
    Best wishes,
    Saugroboter

    Posted: 1 year ago #
  3. Ipstenu (Mika Epstein)
    Lead Plugin Wrangler

    There are plugins that can you help you do this: https://wordpress.org/plugins/radio-buttons-for-taxonomies/

    Posted: 1 year ago #

RSS feed for this topic

Reply

You must log in to post.

  • Rating

    12345
    3 Votes
  • Status

    This is plugin territory

No tags yet.