[wp-trac] [WordPress Trac] #31099: Hook action on publishing custom post type also firing on update

WordPress Trac noreply at wordpress.org
Sat Feb 14 09:10:30 UTC 2015


#31099: Hook action on publishing custom post type also firing on update
--------------------------------------+-----------------------
 Reporter:  yosmc                     |       Owner:  Idealien
     Type:  defect (bug)              |      Status:  closed
 Priority:  normal                    |   Milestone:  4.2
Component:  Posts, Post Types         |     Version:  4.1
 Severity:  normal                    |  Resolution:  fixed
 Keywords:  good-first-bug has-patch  |     Focuses:  docs
--------------------------------------+-----------------------
Changes (by DrewAPicture):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 In [changeset:"31461"]:
 {{{
 #!CommitTicketReference repository="" revision="31461"
 Update the descriptions for `transition_post_status()` and the
 `{$new_stats}_{$post->post_type}` hook with more information about the
 expected behavior of transitioning post statuses.

 In some cases, the values of `$old_status` and `$new_status` may be the
 same thing before and after a post status is "transitioned". An example of
 this would be the scenario where a published post is being updated: the
 status before and after the update both equal 'publish'.

 Further, the documentation clarifies that if the intent is to only execute
 code when initially transitioningto a post status from something else, the
 'transition_post_status' hook should be used instead of one of the dynamic
 hooks to avoid confusion.

 Props Idealien for the initial patch.
 Fixes #31099.
 }}}

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


More information about the wp-trac mailing list