[wp-trac] [WordPress Trac] #35337: Global $post is null in "comment_post" and "pre_comment_on_post" hooks

WordPress Trac noreply at wordpress.org
Mon Jan 11 03:01:33 UTC 2016


#35337: Global $post is null in "comment_post" and "pre_comment_on_post" hooks
--------------------------+--------------------------
 Reporter:  dennis_f      |       Owner:  johnbillion
     Type:  defect (bug)  |      Status:  accepted
 Priority:  normal        |   Milestone:  4.4.2
Component:  Comments      |     Version:  4.4
 Severity:  normal        |  Resolution:
 Keywords:  2nd-opinion   |     Focuses:
--------------------------+--------------------------

Comment (by boonebgorges):

 Replying to [comment:5 johnbillion]:
 > It's worth noting that relying on the global `$post` object during the
 `comment_post` filter is not reliable anyway, because
 [https://core.trac.wordpress.org/browser/tags/4.4.1/src/wp-admin/includes
 /ajax-actions.php?marks=981#L973 it's not globalised when a comment is
 submitted via an AJAX reply in the admin area].
 >
 > For the above reason, I'm inclined to wontfix this, unless I'm mistaken
 or there's another reason to globalise `$post` or any other variables
 inside `wp_handle_comment_submission()`.

 The point about the AJAX handler is pretty persuasive. wontfix seems OK to
 me on those grounds.

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


More information about the wp-trac mailing list