Site logo

Archived topic

Core comment section hooks

3 replies · Started by Dan on May 19, 2021

Viewing posts 1–4 of 4

I see there are some GP hooks for the comment area, but they were not quite in the place I wanted them. I thought I would be able to use an element with a custom hook of comment_notes_before or comment_note_after to add some text into the comment area. I thought these two hooks were part of the core, but I'm not able to get them working. They are at least listed here: https://developer.wordpress.org/reference/hooks/comment_form_defaults/

I was able to get the custom hook comment_form_top working, though. So I know my process is correct.

Any ideas?

Hi there,

Yeah that's the way to do it.

GP uses the default core comment_form() for the actual forms.
https://github.com/tomusborne/generatepress/blob/b60b853630da6d9015722da903e53c8064148b0a/comments.php#L127

And I believe you're trying to hook something within the actual comment form rather than the wrappers/containers of it. In that case, you'll have to scan through the core comment-template.php file and search for the do_action() hooks that fit your need.
https://github.com/WordPress/WordPress/blob/cf90ff2427e68f417a15d72546d0f1445be57b76/wp-includes/comment-template.php#L2560

Got it. Thanks!

No problem. :D

This archived topic is closed to new replies.