Make WordPress Core

Opened 7 months ago

Last modified 4 weeks 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.3 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 7 months ago.

Download all attachments as: .zip

Change History (3)

7 months ago

#1 @johnbillion
7 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 weeks ago

  • Milestone changed from Awaiting Review to 5.3
  • Owner set to johnbillion
  • Status changed from new to accepted
Note: See TracTickets for help on using tickets.