Make WordPress Core

Opened 5 years ago

Closed 4 years ago

Last modified 4 years ago

#46433 closed enhancement (fixed)

Ability to disable calls to wp_add_trashed_suffix_to_post_name_for_trashed_posts()

Reported by: johnbillion's profile johnbillion Owned by: johnbillion's profile johnbillion
Milestone: 5.4 Priority: normal
Severity: normal Version: 4.5
Component: Posts, Post Types Keywords: has-patch
Focuses: performance Cc:


When performing operations where large numbers of posts are saved to the database, one of the bottlenecks is wp_add_trashed_suffix_to_post_name_for_trashed_posts() which is called inside wp_insert_post().

Every time a post is inserted or updated this function is called. It performs a get_posts() call that gets progressively slower the more posts there are. During a large import, it might not be desirable for this trashed post slug handling to occur so there should be a way to disable this for performance reasons (via a filter).

Attachments (1)

46433.patch (1.1 KB) - added by johnbillion 5 years ago.

Download all attachments as: .zip

Change History (9)

5 years ago

#1 @johnbillion
5 years ago

  • Keywords has-patch added; needs-patch removed

Patch that introduces a add_trashed_suffix_to_trashed_posts filter that can be used to disable this functionality.

#2 @johnbillion
5 years ago

  • Milestone changed from Awaiting Review to 5.3
  • Owner set to johnbillion
  • Status changed from new to accepted

#3 @davidbaumwald
5 years ago

  • Keywords commit added

@johnbillion Can this be reviewed and possibly merged by tomorrow for version 5.3 Beta 1? The patch is still clean, and seems to be a sensible solution.

#4 @davidbaumwald
5 years ago

  • Keywords commit removed
  • Milestone changed from 5.3 to Future Release

With version 5.3 Beta 1 landing shortly, this is being moved to Future Release. If any committer can review any merge in time for the beta in time, feel free to move this back into 5.3.

#5 @johnbillion
5 years ago

  • Milestone changed from Future Release to 5.4

#6 @davidbaumwald
4 years ago

@johnbillion Is this still on your plate for 5.4?

#7 @johnbillion
4 years ago

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

In 47203:

Posts, Post Types: Introduce a filter which allows the addition of __trashed suffixes on post slugs to be skipped.

Fixes #46433

This ticket was mentioned in Slack in #cli by johnbillion. View the logs.

4 years ago

Note: See TracTickets for help on using tickets.