Make WordPress Core

Opened 4 years ago

Closed 3 years ago

#48416 closed enhancement (fixed)

Add `saved_term` actions that fire on create and update

Reported by: dlh's profile dlh Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 5.5 Priority: normal
Severity: normal Version:
Component: Taxonomy Keywords: has-patch
Focuses: Cc:

Description

The save_post and save_post_{$post_type} actions fire both when a post is created or updated. Terms have separate created_* and edited_* hooks, but not a shared hook like posts do.

So, if a developer wants to hook into both the create and update events, two add_action()s are required for terms, but only one is required for posts.

This patch proposes adding new saved_term and saved_{$taxonomy} hooks to wp_insert_term() and wp_update_term() to bring the same convenience to terms currently available for posts.

Attachments (1)

48416.diff (1.7 KB) - added by dlh 4 years ago.

Download all attachments as: .zip

Change History (6)

@dlh
4 years ago

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


3 years ago

#2 @SergeyBiryukov
3 years ago

  • Milestone changed from Awaiting Review to 5.5
  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing

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


3 years ago

#4 @davidbaumwald
3 years ago

@SergeyBiryukov Latest patch still applies cleanly. Is this on your list to review for 5.5?

#5 @SergeyBiryukov
3 years ago

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

In 48314:

Taxonomy: Introduce saved_term and saved_{$taxonomy} actions to complement created_term and created_{$taxonomy}.

This allows for hooking into both the create and update events with a single callback, in the same way that is already possible for posts via the save_post and save_post_{$post->post_type} actions.

Props dlh.
Fixes #48416.

Note: See TracTickets for help on using tickets.