Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#51310 closed defect (bug) (invalid)

WordPress app and many plugin is malfunctioning. Publish/Edited post activity is being updated twice in system.

Reported by: arbn's profile arbn Owned by:
Milestone: Priority: normal
Severity: major Version: 5.5.1
Component: Posts, Post Types Keywords:
Focuses: Cc:


Every plugin and even the app is updating the same post activity twice while publishing and editing. My plugin ARROWDAN Notifier is made to send notification on post publish and edit. It was working fine with previous version of wordpress but now its updating twice and sending 2 notification for the same thing. I thought it was bug with my plugin only, but later i tested with other plugin also and found same issue. And not only plugin is affected but also wordpress app is showing publish and edit activity twice in website activity log.
Due to this bug, many plugin is affected.
Test Detail
Used latest version 5.5.1
Tested in more than 4 website
Wordpress app in android phone
In my plugin Save_Post hook is called twice itself by the system. Because my manual send notification is working fine.

Change History (1)

#1 @SergeyBiryukov
4 years ago

  • Component changed from Plugins to Posts, Post Types
  • Keywords needs-patch removed
  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

Hi there, welcome to WordPress Trac! Thanks for the report.

As previously noted in comment:5:ticket:19074, save_post fires twice for any post type that supports revisions:

  • First, it fires for a new revision being created.
  • Then, for the post itself being updated.

When using the save_post hook, you should check the post type of the post object before doing anything. Some examples might be helpful:

Alternatively, you can use the save_post_{$post->post_type} hook that only fires for specific post types.

This works as intended, I don't see a bug here.

Note: See TracTickets for help on using tickets.