To customize the built-in WordPress comments form you could use plugins, but those often slow down your site. A better approach to add custom content to the comments form is by using the WordPress comments form hooks.
List of WordPress Comments Form Hooks
There are seven WordPress comments hooks. Some of them are not available depending the discussion settings (learn more).
- 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
The hooks speak for themselves, but for more comprehensive look see the WordPress Comments Form – Visual Hook Guide.
PHP Snippet: Add custom content above the WordPress comments fields
Lets see how to add our custom content ‘comment policy text’ above the comment fields. To place the content there we’ll use comment_form_top hook.
add_action('comment_form_top', 'webroom_add_comment_notice');
function webroom_add_comment_notice() {
echo '<p>Comment policy: All comments are manually moderated and those deemed to be spam or promotional will be deleted.</p>';
}
PHP Snippet: Add custom content below the WordPress comments fields
Lets see how to add our custom content ‘comment policy text’ below the comment fields and above the Post comment button. To place the content there we’ll use comment_form_after_fields hook.
add_action('comment_form_after_fields', 'webroom_add_comment_notice');
function webroom_add_comment_notice() {
echo '<p>Comment policy: All comments are manually moderated and those deemed to be spam or promotional will be deleted.</p>';
}
PHP Snippet: Add custom content below the Post comment button in WordPress comments
Lets see how to add our custom content ‘comment policy text’ below the comment fields and above the Post comment button. To place the content there we’ll use comment_form_after hook.
add_action('comment_form_after', 'webroom_add_comment_notice');
function webroom_add_comment_notice() {
echo '<p>Comment policy: All comments are manually moderated and those deemed to be spam or promotional will be deleted.</p>';
}
Note that depending the WordPress discussion settings you have some hooks are not available. For example if only logged in users can comment or the comments are disabled for particular post. Learn which WordPress comments form hooks are active depending the settings you have in the WordPress Comments Visual Hooks Guide.
Learn more about Comments in WordPress in the official documentation.
How to add custom content to the WordPress comments form
To customize the built-in WordPress comments form you could use plugins, but those often slow down your site. A better approach to add custom content to the comments form is by using the WordPress comments form hooks.
List of WordPress Comments Form Hooks
There are seven WordPress comments hooks. Some of them are not available depending the discussion settings (learn more).
The hooks speak for themselves, but for more comprehensive look see the WordPress Comments Form – Visual Hook Guide.
PHP Snippet: Add custom content above the WordPress comments fields
Lets see how to add our custom content ‘comment policy text’ above the comment fields. To place the content there we’ll use comment_form_top hook.
add_action('comment_form_top', 'webroom_add_comment_notice'); function webroom_add_comment_notice() { echo '<p>Comment policy: All comments are manually moderated and those deemed to be spam or promotional will be deleted.</p>'; }PHP Snippet: Add custom content below the WordPress comments fields
Lets see how to add our custom content ‘comment policy text’ below the comment fields and above the Post comment button. To place the content there we’ll use comment_form_after_fields hook.
add_action('comment_form_after_fields', 'webroom_add_comment_notice'); function webroom_add_comment_notice() { echo '<p>Comment policy: All comments are manually moderated and those deemed to be spam or promotional will be deleted.</p>'; }PHP Snippet: Add custom content below the Post comment button in WordPress comments
Lets see how to add our custom content ‘comment policy text’ below the comment fields and above the Post comment button. To place the content there we’ll use comment_form_after hook.
add_action('comment_form_after', 'webroom_add_comment_notice'); function webroom_add_comment_notice() { echo '<p>Comment policy: All comments are manually moderated and those deemed to be spam or promotional will be deleted.</p>'; }Note that depending the WordPress discussion settings you have some hooks are not available. For example if only logged in users can comment or the comments are disabled for particular post. Learn which WordPress comments form hooks are active depending the settings you have in the WordPress Comments Visual Hooks Guide.
Learn more about Comments in WordPress in the official documentation.
Recent Articles
Related Articles
If you enjoyed reading this, then please explore our other articles below:
How WooCommerce 10.5 Caches Product Objects to Cut Hydration Overhead
April 3rd, 2026|WooCommerce|
WooCommerce HPOS Full-Text Search Indexes: From Experimental Toggle to Production-Ready Order Lookup
April 3rd, 2026|WooCommerce|
How WooCommerce MCP Turns Your Store Into an AI-Accessible API
April 3rd, 2026|WooCommerce|
Fixing WooCommerce Accessibility for the European Accessibility Act
February 7th, 2026|WooCommerce|
Fixing WooCommerce Query Lag by Optimizing HPOS Custom Queries
February 7th, 2026|WooCommerce|
Fixing Interaction to Next Paint (INP) delays in WooCommerce by optimizing JavaScript execution
February 7th, 2026|WooCommerce|
Why WordPress 7.0 Centralized AI Keys Through the Connectors API
WordPress 7.0 Armstrong: Native AI Client, Abilities API, and What Got Cut
Cloudflare EmDash: A TypeScript CMS That Aims to Replace WordPress Plugin Architecture
WordPress Site Hacked? A Full Recovery Playbook From Containment to Hardening
Git From Scratch: Concepts, Commands, and the Workflow That Actually Sticks
MTA-STS in Enforce Mode: How a Single Misconfigured Policy Blocks Every Gmail Message
WordPress 7.0 RC1 Drops Real-Time Collaboration, AI Connectors, and a Redesigned Dashboard
bfcache, Speculation Rules and AI Debugging – Three Browser Features That Kill Page Load Delays
More Articles
If you enjoyed reading this, then please explore our other articles below:
What Comes After Vibe Coding – and How Does Vibe Engineering With Claude Code Take Things Further?
September 26th, 2026|
How Do You Go From an MVP to a Production-Ready Product With FastAPI, React, and Docker?
September 25th, 2026|
What’s the Best Way to Checkpoint Progress With Git When Building an App With AI Pair Programming?
September 25th, 2026|
How Do You Manage Context Windows and Fresh Chat Sessions to Keep Your AI Coding Agent Efficient?
September 24th, 2026|
What Does It Look Like to Build a Kanban Board With AI Chat Functionality Using GitHub Copilot?
September 24th, 2026|
How Do You Integrate an AI Assistant Into a Full-Stack App Using OpenRouter?
September 23rd, 2026|
How Do You Guide an AI Developer Agent When It Gets Stuck in a Debugging Loop?
September 23rd, 2026|
What’s the Best Workflow for Git Checkpointing While Building an App Using Only Copilot and Codex?
September 22nd, 2026|
How Do You Persist Kanban Board State Across Sessions Using a Proper Database Schema Instead of a JSON Blob?
September 22nd, 2026|
How WooCommerce 10.5 Caches Product Objects to Cut Hydration Overhead
April 3rd, 2026|WooCommerce|
WooCommerce HPOS Full-Text Search Indexes: From Experimental Toggle to Production-Ready Order Lookup
April 3rd, 2026|WooCommerce|
How WooCommerce MCP Turns Your Store Into an AI-Accessible API
April 3rd, 2026|WooCommerce|
Fixing WooCommerce Accessibility for the European Accessibility Act
February 7th, 2026|WooCommerce|
Fixing WooCommerce Query Lag by Optimizing HPOS Custom Queries
February 7th, 2026|WooCommerce|
Fixing Interaction to Next Paint (INP) delays in WooCommerce by optimizing JavaScript execution
February 7th, 2026|WooCommerce|
How WooCommerce 10.5 Caches Product Objects to Cut Hydration Overhead
April 3rd, 2026|WooCommerce|
WooCommerce HPOS Full-Text Search Indexes: From Experimental Toggle to Production-Ready Order Lookup
April 3rd, 2026|WooCommerce|
How WooCommerce MCP Turns Your Store Into an AI-Accessible API
April 3rd, 2026|WooCommerce|
Fixing WooCommerce Accessibility for the European Accessibility Act
February 7th, 2026|WooCommerce|
Fixing WooCommerce Query Lag by Optimizing HPOS Custom Queries
February 7th, 2026|WooCommerce|
Fixing Interaction to Next Paint (INP) delays in WooCommerce by optimizing JavaScript execution
February 7th, 2026|WooCommerce|