[wp-trac] [WordPress Trac] #19074: 'transition_post_status' is executed before 'save_post'

WordPress Trac noreply at wordpress.org
Thu Mar 9 18:36:34 UTC 2017


#19074: 'transition_post_status' is executed before 'save_post'
-------------------------------+----------------------
 Reporter:  M66B               |       Owner:
     Type:  defect (bug)       |      Status:  closed
 Priority:  normal             |   Milestone:
Component:  Posts, Post Types  |     Version:  3.2.1
 Severity:  normal             |  Resolution:  invalid
 Keywords:                     |     Focuses:
-------------------------------+----------------------

Comment (by nhangen):

 I hate to necro an old ticket, but I've been struggling for 3 days to
 discern why wp_transition_post_status wasn't working on new posts, and
 finally found this ticket, which points to the answer.

 Because wp_transition_post_status fires early, we don't have access to a
 new post's post->ID, which means we can't grab metadata or a legitimate
 post object. We also don't actually know if the post was saved at all.

 I understand that you can't modify this method, but the documentation
 should be updated in order to reflect the deficiencies of this hook. It's
 basically useless on anything but saved posts.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/19074#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list