Skip to content

wp post term remove reports success when the term is not assigned #691

Open

Description

@dhrupo

wp post term remove prints Success even when nothing was removed:

$ wp post term add 1 post_tag apple
$ wp term create post_tag banana
$ wp post term remove 1 post_tag banana
Success: Removed term.

banana was never assigned to post 1. wp_remove_object_terms() returns false when no relationship was deleted, and WP_Error only for an invalid taxonomy or term lookup error. CommandWithTerms::remove() checks only is_wp_error(), so false falls through to the success message. wp user term remove uses the same class.

Expected: an error with a non-zero exit code, the same as wp post meta delete on a key that is not set (Error: Failed to delete custom field.).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions