WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#20433 closed defect (bug) (fixed)

Don't update last_updated when deleting non-published posts

Reported by: ryan Owned by: ryan
Milestone: 3.4 Priority: normal
Severity: normal Version:
Component: Multisite Keywords: has-patch
Focuses: Cc:

Description

add_action( 'delete_post', 'wpmu_update_blogs_date' );

Instead of that, let's hook in an action that checks the post status and updates only when published posts are deleted. This will avoid lots of updates to wp_blogs when cleaning out old auto-draft posts.

Inspired by #19663. [20440] caused massive numbers of updates to wp_blogs.

Attachments (2)

20433.patch (644 bytes) - added by SergeyBiryukov 3 years ago.
20433.2.patch (1.4 KB) - added by SergeyBiryukov 3 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 @ryan3 years ago

  • Summary changed from Don't update last_updated when deleting nn-published posts to Don't update last_updated when deleting non-published posts

comment:2 @nacin3 years ago

We can probably re-purpose what went in for [19129].

@SergeyBiryukov3 years ago

comment:3 @SergeyBiryukov3 years ago

  • Keywords has-patch added

Just removing the action seems enough. _update_blog_date_on_post_publish() handles the rest.

comment:4 @azaozz3 years ago

Perhaps also bypass it when deleting trashed posts. Form the user's point of view they are long gone and nothing has changed.

comment:5 @ryan3 years ago

Just removing the action will work fine for trashed posted that are later deleted as_update_blog_date_on_post_publish() will indeed handle things. But, it won't work for forced deletions. We don't care about the auto-draft forced deletions, but are there forced deletes we should care about?

@SergeyBiryukov3 years ago

comment:6 @SergeyBiryukov3 years ago

20433.2.patch introduces _update_blog_date_on_post_delete().

comment:7 @ryan3 years ago

  • Owner set to ryan
  • Resolution set to fixed
  • Status changed from new to closed

In [20461]:

Don't update a blog's last_updated time for all post deletions. Update only when published posts are deleted.

Props SergeyBiryukov
fixes #20433

Note: See TracTickets for help on using tickets.