[wp-trac] [WordPress Trac] #40352: WP REST API, Comments Not Triggering 'comment_post'

WordPress Trac noreply at wordpress.org
Tue Apr 4 06:50:39 UTC 2017


#40352: WP REST API, Comments Not Triggering 'comment_post'
--------------------------+-----------------------------
 Reporter:  stickypixel   |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  REST API      |    Version:  4.7.3
 Severity:  normal        |   Keywords:
  Focuses:  rest-api      |
--------------------------+-----------------------------
 Hello,

 I’ve noticed that when comments are created using the WP API that
 notification emails are not sent out to the author of the post or
 moderators. (When testing, If I add the comment via the admin interface,
 it works as expected).

 On debugging, I noticed that the filter ‘comment_post’ is not being called
 when inserted via the API. For now, I used the following workaround:

 {{{#!php
 function mytheme_comment_inserted($comment_id, $comment_object) {
   wp_notify_postauthor( $comment_id );
 }
 add_action('wp_insert_comment','mytheme_comment_inserted');
 }}}

 I already posted on the support forum here:
 https://wordpress.org/support/topic/wp-api-comments-not-sending-
 notifications/#post-8987973 and it was suggested this could be intentional
 behaviour but that this also could, in fact, be reported as a bug?

 Thanks!

 Chris

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


More information about the wp-trac mailing list