Enabling WordPress Comments for Pages

enable page comments - wordpress

By default WordPress pages do not display comments. If you want your users to be able to comment on your pages you need to edit your page.php file.

Create a child theme, copy page.php into your child theme directory, and make your changes there so that you won’t risk losing your changes/updates in case of a theme update.

To add comment support on your pages add the following piece of code inside your page.php that you just copied into your child theme directory:

You can add it just before closing “endwhile” inside “if (have_posts())” condition, before “<?php endwhile; endif; ?>”.

More info about comments_template: https://developer.wordpress.org/reference/functions/comments_template/

After adding this piece of code go to settings -> Discussion and allow posting comments on new articles. You may also need to select screen options and then scroll to the bottom to enable comments for individual pages.

Check out this plugin to enable comments on pages by default: https://wordpress.org/plugins/no-page-comment/

Hope this helps.
Good Luck,
Serdar

Leave a Reply

Your email address will not be published. Required fields are marked *