Skip to content

Use get_object_taxonomies() for taxonomy list by post type object #181

Closed

Description

@grappler

I was running the command from the example wp taxonomy list --object_type=post --fields=name,public and could not figure out why all of the taxonomies were not being displayed.

One of the taxonomies that was connected to the "post" object was also associated with other post types. Turns out this is one of the limitations(Core Trac) of get_taxonomies() which is used by wp taxonomy list.

A solution would be to use get_object_taxonomies() instead.

I am not sure what the solution would be here. Perhaps add a different flag or add a new command.

Activity

  1. schlessera commented on May 8, 2018

    @schlessera
    Member

    Changing this to use get_object_taxonomies() would be a breaking change, even if it would be a good one, so we have to consider the impact and the best course of action.

    My general feel would be that the breaking change in this instance would not be a big issue, as I cannot think of a lot of use cases for actually scripting taxonomies and then failing over having more taxonomies than expected.

    However, this might catch people by surprise that know of the Core behavior and expect WP-CLI to match that behavior.

    I would be up to exploring adding a --strict filter, with --strict matching get_taxonomies() and --no-strict matching get_object_taxonomies(). I also think we could default to --no-strict without too many expected issues.

  2. added
    command:taxonomy-list
    on May 8, 2018
  3. added 4 commits that reference this issue on May 5, 2019
  4. added a commit that references this issue on May 13, 2019
  5. added 5 commits that reference this issue on Jan 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcommand:taxonomy-list

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions