Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#38006 closed defect (bug) (fixed)

wp_remove_object_terms() should pass $taxonomy to its actions

Reported by: boonebgorges's profile boonebgorges Owned by: takahashi_fumiki's profile Takahashi_Fumiki
Milestone: 4.7 Priority: normal
Severity: normal Version:
Component: Taxonomy Keywords: needs-patch
Focuses: Cc:

Description

wp_set_object_terms() passes the $taxonomy parameter to its actions, but wp_remove_object_terms() does not. This makes it hard to target term removal for specific taxonomies.

Attachments (3)

38006.diff (721 bytes) - added by Takahashi_Fumiki 8 years ago.
Add 3rd param to 'deleted_term_relationships' action.
38006.2.diff (2.2 KB) - added by Takahashi_Fumiki 8 years ago.
Add 3rd param $taxonomuy to 'deleted_term_relationships', 'delete_term_relationships', 'added_term_relationship', 'add_term_relationship' actions.
38006.3.diff (2.7 KB) - added by Takahashi_Fumiki 8 years ago.
Add since tag to inline document.

Download all attachments as: .zip

Change History (9)

@Takahashi_Fumiki
8 years ago

Add 3rd param to 'deleted_term_relationships' action.

#1 @Takahashi_Fumiki
8 years ago

@boonebgorges function wp_remove_object_terms() doesn't seem to have set_object_terms actions equivalent.
So, I add a new param to deleted_term_relationships action but it is equivalent of added_term_relationship.

This ticket was mentioned in Slack in #core by mike. View the logs.


8 years ago

@Takahashi_Fumiki
8 years ago

Add 3rd param $taxonomuy to 'deleted_term_relationships', 'delete_term_relationships', 'added_term_relationship', 'add_term_relationship' actions.

#3 @Takahashi_Fumiki
8 years ago

wp_remove_object_terms() function doesn't have the equivalent of set_object_terms action.
Add new argument $taxonomy to all of actions below:

  • add_term_relationship
  • added_term_relationship
  • delete_term_relationships
  • deleted_term_relationships

They don't equals completely (singular/plural), but they are similar.

#4 @boonebgorges
8 years ago

  • Keywords good-first-bug removed
  • Milestone changed from Future Release to 4.7
  • Owner set to Takahashi_Fumiki
  • Status changed from new to assigned

This looks great, @Takahashi_Fumiki. Thanks for the patch!

One more small request: Could you please add @since annotations for the new parameters? Something like:

 * @since 4.7.0 Added the `$taxonomy` parameter.

See https://make.wordpress.org/core/handbook/best-practices/inline-documentation-standards/php/#since-section-changelogs for more information.

@Takahashi_Fumiki
8 years ago

Add since tag to inline document.

#5 @Takahashi_Fumiki
8 years ago

@boonebgorges Thank you for your adivice. Added @since tag.

#6 @boonebgorges
8 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 38621:

Pass taxonomy name to actions in term-relationship CRUD functions.

Props Takahashi_Fumiki.
Fixes #38006.

Note: See TracTickets for help on using tickets.