Troubleshooting Guide
Troubleshooting Guide
This section helps you resolve common issues encountered while using the Private Comments plugin.
Comments are visible to everyone
If users who are not the comment author, post author, or an administrator can see comments, check the following:
- Caching Plugins: Most WordPress caching plugins (like WP Rocket, W3 Total Cache, or LiteSpeed Cache) serve static HTML versions of your pages. If a page was cached while an administrator was viewing it, that version might be served to public visitors.
- Solution: Clear your site cache and check if the issue persists. If it does, consider disabling "Object Cache" for comment-related queries or excluding the comment section from being cached.
- Theme Compatibility: Some custom themes use non-standard database queries to display comments, bypassing the native WordPress filters the plugin relies on.
- Solution: Temporarily switch to a default theme (like Twenty Twenty-Four) to see if the comments become private. If they do, your theme is likely using a custom
WP_Comment_Querythat requires manual integration.
- Solution: Temporarily switch to a default theme (like Twenty Twenty-Four) to see if the comments become private. If they do, your theme is likely using a custom
Authors cannot see their own comments
If a user has posted a comment but cannot see it after the page refreshes, verify the following:
- Login Status: The plugin identifies the comment author based on their WordPress User ID. If a user posts a comment while logged out (using just an email address) and then logs in, or vice versa, the plugin may not be able to link their identity.
- Solution: Ensure the user is logged in when posting and viewing the comment.
- Comment Moderation: If your WordPress settings require comments to be manually approved, the comment may not appear until an administrator approves it, depending on your theme's configuration.
Post Authors cannot see comments on their posts
If a Post Author (user role) cannot see comments left by others on their own posts:
- Capabilities Check: Ensure the user has the
edit_postscapability for that specific post. The plugin checks permissions based on whether the current user is designated as the post's author in the WordPress database. - Multiple Author Plugins: If you use a plugin like "Co-Authors Plus," the Private Comments plugin might only recognize the primary author listed in the default WordPress author field.
Conflicts with Caching and CDN
Because this plugin changes content based on the "Identity" of the visitor, it is highly sensitive to Page Caching.
- Symptoms: A logged-out user sees comments meant for an admin, or an admin sees a "no comments" message.
- Fix: Most caching plugins have a setting to "Disable caching for logged-in users." Enable this setting to ensure that authors and admins always see the correct, private comment stream.
Debugging with Code
If you need to verify if the plugin filters are active, you can check the comment count returned by your theme. The plugin hooks into the_comments_query. You can test the output by adding this temporary snippet to your functions.php to see how many comments are being retrieved for the current user:
add_filter('wp_count_comments', function($stats, $post_id) {
// This will show the total counts;
// Private Comments filters the actual list, not necessarily the total stats.
return $stats;
}, 10, 2);
Still having issues?
If the solutions above do not resolve your problem:
- Check for Plugin Conflicts: Disable all other plugins except Private Comments. If the issue is resolved, reactivate plugins one by one to find the conflict.
- Check Server Logs: Look for PHP errors in your server's
error.logfile that might indicate a conflict with your WordPress version. - Submit a Report: If you believe you've found a bug, please submit an issue on GitHub with your WordPress version, Theme name, and a list of active caching plugins.