Make WordPress Core

Opened 8 years ago

Closed 7 years ago

Last modified 7 years ago

#46433 closed enhancement (fixed)

Ability to disable calls to wp_add_trashed_suffix_to_post_name_for_trashed_posts()

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

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 8 years ago.

Download all attachments as: .zip

Change History (9)

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

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

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

  • Keywords commit removed
  • Milestone 5.3 → 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
7 years ago

  • Milestone Future Release → 5.4

#6 @davidbaumwald
7 years ago

@johnbillion Is this still on your plate for 5.4?

#7 @johnbillion
7 years ago

  • Resolution → fixed
  • Status accepted → 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.


7 years ago

Note: See TracTickets for help on using tickets.