Support » Plugin: Paid Memberships Pro » How to make "Categories" only visible by Paid Members?

  • Resolved kaity123



    Is there a way with PMP 1.7.5 to “only” show the Categories widget/menu to paid subscriber and not the general public?

    I just want a sales page where I sell the membership, but once the person registers (pays) they get to see the categories of different courses (which I keep adding) in the sidebar of WP.

    If I add the “categories” widget to the sidebar, everyone sees them including non-paying members. Can I hide it for only members?

    Really don’t know how to setup menus properly for paid and non-paid members for my site.

    Using: WordPress 3.8, Paid Membership Pro 1.7.5, WP Theme “Twenty Fourteen”.


Viewing 8 replies - 1 through 8 (of 8 total)
  • You could modify the sidebar.php file of your theme to do this without using the categories widget directly.

    Something like:

    if( pmpro_hasMembershipLevel( array( 'Free', 'Bronze', 'Silver', 'Gold' ) ) ) {
     $categories = wp_list_categories( array (
                                                    'show_option_all'    => '',
                                                    'orderby'            => 'name',
                                                    'order'              => 'ASC',
                                                    'style'              => 'list',
                                                    'show_count'         => 1,
                                                    'hide_empty'         => 1,
                                                    'use_desc_for_title' => 0,
                                                    'child_of'           => 0,
                                                    'feed'               => '',
                                                    'feed_type'          => '',
                                                    'feed_image'         => '',
                                                    'exclude'            => '',
                                                    'exclude_tree'       => '',
                                                    'include'            => '',
                                                    'hierarchical'       => 1,
                                                    'title_li'           => '',
                                                    'show_option_none'   => __( 'No categories' ),
                                                    'number'             => null,
                                                    'echo'               => 0,
                                                    'depth'              => 0,
                                                    'current_category'   => get_the_category()[ 0 ]->cat_ID,
                                                    'pad_counts'         => 1,
                                                    'taxonomy'           => 'category',
                                                    'walker'             => null
         ) );
        $categories = str_replace( 'current-cat', 'active', $categories );
        $categories = preg_replace( '/\((\d+)\)(?=\s*+<)/', '<span class="badge pull-right">$1</span>', $categories );
        echo $categories;


    Hi Adam,

    Thanks, however when I put the following code in my sidebar.php I get the following error:

    ” Parse error: syntax error, unexpected ‘[‘, expecting ‘)’ in [snipped for content] on line 34 “

    I’m a newbie when it comes to coding, but I did put the following in the beginning “<?php”, and “<?php endif; ?> ” at the end, but there is a ‘ missing somewhere and I don’t know where. If you could help – I sincerely appreciate it! 🙂


    Is line 34 the 'current_category' => get_the_category()[ 0 ]->cat_ID, line in your script?

    If so its because you’re running an older version of php which doesn’t support addressing arrays directly after a function call.

    What you’d need to do instead is define a variable first:

    $category = get_the_category() and then change the other line 'current_category' => $category[ 0 ]->cat_ID,.

    Also should have said the str_replace and preg_replace lines are only necessary if you’re using Twitter’s Bootstrap for formatting.

    Hi All,

    Sorry about the late reply here.

    @kaity123 – There’s a much easier way than modifying the sidebar. Under the Membership Levels (each individual level) there’s a way to specify which categories should be protected by a level. You’ll want to check off the category you’d like to protect and then save your settings.

    @adam – Thanks for the replies/help!

    Hi all

    I’ve just set one of my categories — ‘Audio’ — to a designated membership level.

    All fine — but my site’s menu is arranged per category heading. When I click on ‘audio’ I get a ‘no posts found’ page, rather than the ‘this content is membership only’ message.

    Does anyone know how can I make the category menu page membership only too — rather than just have it showing up as ‘no posts found’?


    Plugin Author messica


    This issue might be caused by some of the changes we’ve made to the search filter in recent updates. Try switching “Filter searches and archives?” to “No’ under Memberships > Advanced Settings in the WordPress dashboard and see if that helps.


    Exactly what I was after — the category home page now displays the recent posts, but with the associated ‘this content is for members only’ message.

    Thanks so much for your help Jess. It’s really appreciated.


    Plugin Author messica


    No problem! I’m going to close this since it’s so old. Please start a new topic next time to avoid clutter, thanks!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘How to make "Categories" only visible by Paid Members?’ is closed to new replies.