Membership Plugin

WordPress Membership Plugin

  • Home
  • Documentation
  • Addons
  • Support
    • Quick Setup
    • Documentation
    • Premium Addon Support
    • Paid Support
    • Support Forum
    • Support Forum Search
    • Forum Login
    • Forum Registration
  • Contact

[Resolved] SWPM Comment Protection Not Working with the Twenty Twenty-Five Block Theme

Simple Membership Plugin › Forums › Simple Membership Plugin › SWPM Comment Protection Not Working with the Twenty Twenty-Five Block Theme

  • This topic has 3 replies, 2 voices, and was last updated 2 weeks, 2 days ago by zequk.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • November 4, 2026 at 4:15 am #32455
    zequk
    Participant

    Hello,

    I have encountered an issue with Simple Membership (SWPM) 4.8.6 after changing my WordPress theme to Twenty Twenty-Five (TT5), and I would appreciate your advice.

    **Environment:**
    – WordPress: 7.1.4
    – Simple Membership: 4.8.6
    – Theme: Twenty Twenty-Five (TT5), the official WordPress block theme

    **What used to happen:**

    With my previous theme, comments on protected posts were also protected by SWPM.

    When a visitor was not logged in, the actual comment content was not displayed. Instead, SWPM automatically displayed the following message in Japanese:

    “This content is only available to logged-in users.”

    Logged-in members could view the comments normally.

    **What happens now:**

    After switching to Twenty Twenty-Five, comments on the same protected posts are visible even to visitors who are not logged in.

    However, the ability to submit comments is still restricted to logged-in users, as before.

    In other words, the restriction on posting comments is working, but the restriction on viewing existing comments no longer seems to work.

    **What I have checked:**

    1. I upgraded SWPM to version 4.8.6 before changing the theme. The comment protection was still working with my previous theme after the SWPM upgrade.
    2. I have not changed any SWPM settings related to content protection or comments.
    3. The previous theme’s functions.php contained no custom code for restricting comment visibility. The only comment-related code removed the default notes displayed before the comment form.
    4. The previous theme’s comments.php file did not contain any custom modifications.
    5. In the Twenty Twenty-Five Site Editor, the Single Posts template contains the standard Comments block, including the Comment Template and Comment Content blocks.

    **My questions:**

    1. Does SWPM’s automatic comment protection work with WordPress block themes such as Twenty Twenty-Five?
    2. Is there a known compatibility issue that prevents SWPM from applying its protection message to the Comment Content block?
    3. Is there a recommended setting, workaround, or code modification that would restore the previous behavior, so that only logged-in members can view existing comments on protected posts?

    I would like to retain the current block theme while restoring the comment protection behavior that worked with my previous theme.

    I can also provide screenshots of the previous behavior and the current Comments block configuration if needed.

    Thank you very much for your time and assistance.

    November 4, 2026 at 4:53 am #32457
    admin
    Keymaster

    Edited

    November 4, 2026 at 4:57 am #32458
    admin
    Keymaster

    Hi, Thank you for the detailed report. It made this easy to track down.

    You’re right. Our comment protection wasn’t applying to the Comment Content block used by block themes such as Twenty Twenty-Five. Classic themes weren’t affected, which is why it worked with your previous theme. Comment posting uses a separate check, so that part kept working as expected.

    We have fixed this in the plugin, and the fix will be in the next release. After you update, the comment protection will work with your block theme the same way it did before, with no changes needed on your end.

    If you’d like the protection back before the update is out, you can add the following snippet to your site using a plugin like Code Snippets (or your child theme’s functions.php file):

    
    add_filter( 'comment_text', function( $content, $comment = null ) {
        if ( is_admin() || ! is_a( $comment, 'WP_Comment' ) || ! class_exists( 'SwpmAccessControl' ) ) {
            return $content;
        }
        return SwpmAccessControl::get_instance()->filter_comment( $comment, $content );
    }, 20, 2 );
    

    You can remove the snippet after you update the plugin.

    November 4, 2026 at 6:03 am #32459
    zequk
    Participant

    Thank you very much for your quick response and for tracking down the issue so efficiently.

    I added the code snippet you provided to my theme’s functions.php, and I can confirm that comment protection is now working correctly with the Twenty Twenty-Five theme. Comments are hidden from visitors who are not logged in, just as they were with my previous theme.

    I really appreciate that you not only identified the cause but also provided a temporary solution while preparing the permanent fix for the next release.

    Thank you again for your excellent support and for taking the time to resolve this issue. I look forward to the next release!

  • Author
    Posts
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
Log In

Please read this message before using our plugin.

Search

Featured Addons and Extensions

  • Membership Form Builder Addon
  • Member Directory Listing Addon
  • WooCommerce Payment Integration
  • Member Data Exporter Addon

Documentation

  • Documentation Index Page

Copyright © 2026 | Simple Membership Plugin | Privacy Policy