If you have enabled the build-in comments section in your WordPress site and want to modify it, you’ve come to the right place. Customizing the WordPress comments form is easy with the corresponding WordPress comments form hooks. You can add different content before or after the comments form or even after the form fields and above the Post comment button.
This visual guide for the WordPress comment form hooks will help you easily understand and find the right spot to add your custom content.
WordPress Comments – Visual Hook Guide
1. If the user is NOT logged in
The following hooks are available when the user is not logged in and is allowed to comment on the post and the comments are not closed:
2. If the user is logged in
If you are logged in, there are fewer hooks available since the name, email and website fields are not needed. The following hooks are not available when the user is logged in:
- form_comment_before_fields
- form_comment_after fields
3. User is not logged and “Users must be registered and logged in to comment” is activated
All unregistered users will see the following comment form with an additional hook: comment_form_must_log_in_after.
WordPress Comments Hooks
Here is a sum of the total seven WordPress comments hooks:
- comment_form_before
- comment_form_top
- comment_form_before_fields
- comment_form_after_fields
- comment_form
- comment_form_must_log_in_after
- comment_form_after
Learn more about Comments in WordPress.
If you have enabled the build-in comments section in your WordPress site and want to modify it, you’ve come to the right place. Customizing the WordPress comments form is easy with the corresponding WordPress comments form hooks. You can add different content before or after the comments form or even after the form fields and above the Post comment button.
This visual guide for the WordPress comment form hooks will help you easily understand and find the right spot to add your custom content.
WordPress Comments – Visual Hook Guide
1. If the user is NOT logged in
The following hooks are available when the user is not logged in and is allowed to comment on the post and the comments are not closed:
comment_form_before
comment_form_after
2. If the user is logged in
If you are logged in, there are fewer hooks available since the name, email and website fields are not needed. The following hooks are not available when the user is logged in:
3. User is not logged and “Users must be registered and logged in to comment” is activated
All unregistered users will see the following comment form with an additional hook: comment_form_must_log_in_after.
comment_form_before
comment_form_after
WordPress Comments Hooks
Here is a sum of the total seven WordPress comments hooks:
Learn more about Comments in WordPress.
Recent Articles
Get
Professional WordPress Speed Optimization Service
Related Articles
If you enjoyed reading this, then please explore our other articles below:
How to redirect to “All Posts” after post update or publish in Block Editor
Top Emerging Web Development Trends in 2022/2023
How to Publish a Plugin to the WordPress Plugin Directory
Why WooCommerce Product Labels and Badges are Important?
Top 3 Tips to Migrate from Wix to WordPress
7 Ideas to Monetize a Website and Increase Your Income
How to display subcategories in Category pages in WordPress
What is WebP and how to speed up WordPress by reducing the size of photos by up to 35%