Option to hide categories with category protection

There's a page on my site with the option to protect some of the categories created, but as of now, it display the name of the categories instead of hiding those from all the users.

The plugin works fine if a user without a membership tries to access those (it shows the login screen for memberships) but I was wondering if there could be an option to NOT show the categories unless the user has an active session and a membership assigned?

There's also an issue with the replace menu which should not be shown here http://take.ms/zuPh9 because the site is viewed from a inactive user, the menu that should be shown there is a different one but it looks like M2 is not displaying it (options are saved but not being taken)

What I would like to do is:
- Display a different menu for inactive users or users that are not part of the membership
- Not show the categories for inactive users or users that don't have a membership

Thanks in advance!

  • Predrag Dubajic

    Hi James,

    Hope you're doing well.

    As Jorge mentioned in chat hiding the categories completely is not possible from the plugin options.
    However with Membership 2 you are getting custom class for each member and membership so we can use that to hide certain stuff on the page and then display it based on the membership ID.

    So to do this you will first need to hide your elements, we can do this with this CSS code:

    #menu-item-1239 {
        display: none;

    Each category item in sidebar has it's own ID and those are the ones listed in the code, if you want to show certain one just remove it's line from the code.

    After that we can bring it up only for admins and members with membership, and we can do that with this code:

    .admin-bar #menu-item-1235,
    .admin-bar #menu-item-1236,
    .admin-bar #menu-item-1237,
    .admin-bar #menu-item-1238,
    .admin-bar #menu-item-1239,
    .ms-1184 #menu-item-1235,
    .ms-1184 #menu-item-1236,
    .ms-1184 #menu-item-1237,
    .ms-1184 #menu-item-1238,
    .ms-1184 #menu-item-1239 {
        display: block;

    WordPress offers Custom CSS field inside Appearance > Customizer but if your theme disables this and it doesn't have its own CSS field you may wish to use a child theme or a plugin like this one for this additional CSS. That way you're protected when you come to upgrade.

    As for the menu protection, I was doing some checkups on my installation and it looks like at this moment the menu protection is working on for default menu functionality, like the ones used in header, and it doesn't replace the menu if it's used as a widget.
    I have reported this to our developers for further investigation.

    Best regards,

  • James

    Hi Predrag,

    Thanks for the info. Yes the theme has a custom css area so I've put the code in and it does hide the menu as you descibed.

    I'd appreciate hearing back from what your developers says about menu protection in widgets.

    In regards to hiding the categories page altogether from public, I guess if the membership plugin just can't do it, then I'll need to rethink how to do all this anyway. If it's not something that you will be changing within Membership, I'd suggest that you at least change the wording of the "Category Protection" section as it is mis-leading. It should say something like "hide posts based on category" which is much closer description of what that feature is actually doing.

    If you would be able to get back to me to let me know if you'll be able to change the way the "Category Protection" works, that will help me decide how I can move forward from here.

    Thanks very much,

  • Predrag Dubajic

    Hi James,

    I have already created a bug report so devs will be checking this for the next release.

    What we can do now as a workaround is to register new menu and add it to the sidebar via shortcode, that way the protection will work properly.
    In order to do this we will need to add some code, and I created a mu-plugin for you already so you can download it below, place it inside the /wp-content/mu-plugins/ folder, if you don't have that folder create it yourself.

    This mu-plugin registers a new menu and a shortcode that we can use to call our custom menu.

    So after the file is in place you can go to Appearance > Menus in your site and in there you will see new display location for your menus called "Custom Menu".
    Based on your M2 settings you will want to set "Manual" menu as your "Custom Menu".

    After that go to Appearance > Widgets and add text widget to your sidebar and in there add this shortcode: [my_custom_menu]

    Now, since your M2 protection is set to replace "Manual" menu with "Public Blog Categories" that should be it, your "Public Blog Categories" menu should be shown to members of "GSO Manual" members.

    As for the categories protection, I'm afraid that this is how the plugin was designed to work and the add-on description does state "Protect your posts by category".
    At the moment there are no plans to change this but I will check with the devs if they can consider adding it as featured request for future releases.

    Best regards,

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.