WordPress.org

Make WordPress Core

Opened 9 months ago

Last modified 2 months ago

#46433 accepted enhancement

Ability to disable calls to wp_add_trashed_suffix_to_post_name_for_trashed_posts()

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

Description

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 9 months ago.

Download all attachments as: .zip

Change History (6)

@johnbillion
9 months ago

#1 @johnbillion
9 months 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
4 months ago

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

#3 @davidbaumwald
3 months 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
3 months 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
2 months ago

  • Milestone changed from Future Release to 5.4
Note: See TracTickets for help on using tickets.