Comments displayed on confirmation/preferences pages
-
This is a problem that several people have reported encountering. After spending quite a bit of time trying to find an elegant, plugin code-based solution, I have determined that the best way to solve this is to explain what the problem is and how to fix it if it happens to you.
This is a theme issue. Depending on how your theme author has chosen to implement the page template, you may be getting comments rendered regardless of how you’ve defined comment visibility system-wide. You would see this problem not just with Post Notif’s “pseudo” (programmatically-generated) pages (subscription confirmation and category preference pages) but also with any pages you create via the WordPress dashboard.
Therefore, fixing this issue should be done in the theme code itself, not via a klugey plugin that somehow interferes with theme rendering. Further, the fix is simple and is patterned after the Twenty Fourteen, Twenty Fifteen and Twenty Sixteen themes that come with WordPress core, as well as the _s theme (https://github.com/Automattic/_s/blob/master/page.php), used as a basis for many additional themes.
If you have access to edit your theme files, open “../wp-content/themes/[theme name]/page.php”, and replace the following line:
<?php comments_template( ”, true ); ?>
with these:
<?php
// If comments are open or we have at least one comment, load up the comment template.
if ( comments_open() || get_comments_number() ) :
comments_template();
endif;
?>If you are uncomfortable with or physically unable to make this change yourself, I strongly encourage you to contact the author of your theme and ask them to consider updating their code such that it respects an admin’s desire to suppress comments. Actually, you should do this even if you are able to change the code yourself!
Hope this helps,
Devon
- The topic ‘Comments displayed on confirmation/preferences pages’ is closed to new replies.