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

WordPress Trac noreply at wordpress.org
Thu Jan 22 17:18:22 UTC 2015


#31099: Hook action on publishing custom post type also firing on update
--------------------------+-----------------------------
 Reporter:  yosmc         |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  4.1
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 I am using the following hook to add an action after my custom post type
 has been published.

 add_action('publish_my-custom-post-type', 'my-function-on-publish');

 As it turns out, however, it's actually firing every time the post is
 updated, not just when it's published. According to the handbook, however,
 it should only fire when status changes TO published.

 PS: I'm seeing the same behavior with WordPress 3.9.X as well as 4.X

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


More information about the wp-trac mailing list