WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 3 years ago

#22293 closed enhancement (fixed)

New filter for wp_update_term and wp_insert_term

Reported by: baernty Owned by: SergeyBiryukov
Milestone: 4.7 Priority: normal
Severity: normal Version:
Component: Taxonomy Keywords: has-patch 4.7-early
Focuses: Cc:
PR Number:

Description

I need a filter for $slug in this function. I want to check if there is a page with the same slug, because i don't use the category base.

Thanks very much.

Attachments (2)

22293.diff (2.0 KB) - added by atimmer 4 years ago.
22293.2.diff (1.8 KB) - added by SergeyBiryukov 3 years ago.

Download all attachments as: .zip

Change History (15)

#1 @baernty
7 years ago

  • Cc baernty added

#2 @baernty
7 years ago

and of course, also for a new term in wp_insert_term
THANKS!

#3 @SergeyBiryukov
7 years ago

create_term or edit_term actions can be used to update the slug right after the term is created or updated.

#4 @nacin
6 years ago

  • Component changed from General to Taxonomy

#5 @boonebgorges
5 years ago

#27678 was marked as a duplicate.

#6 @chriscct7
4 years ago

  • Keywords needs-patch added

#7 @atimmer
4 years ago

  • Summary changed from New Filter for wp_update_term to New filter for wp_update_term and wp_insert_term

@atimmer
4 years ago

#8 @atimmer
4 years ago

  • Keywords has-patch added; needs-patch removed

22293.diff adds a filter to both wp_insert_term and wp_update_term to filter the slug that will be saved.

#9 @SergeyBiryukov
4 years ago

  • Keywords 4.6-early added
  • Milestone changed from Awaiting Review to Future Release
  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing

#10 @SergeyBiryukov
3 years ago

  • Keywords 4.7-early added; 4.6-early removed

22293.2.diff adds wp_insert_term_data and wp_update_term_data filters, which I think would be more useful than a filter just for the slug.

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


3 years ago

#12 @helen
3 years ago

  • Milestone changed from Future Release to 4.7

Go forth and Sergey-bot.

#13 @SergeyBiryukov
3 years ago

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

In 38484:

Taxonomy: Introduce wp_insert_term_data and wp_update_term_data filters for altering term data before it is inserted/updated in the database.

Props atimmer, SergeyBiryukov.
Fixes #22293.

Note: See TracTickets for help on using tickets.