Support » Plugin: Members - Membership & User Role Editor Plugin » Restrict Access to Posts Page

  • Resolved mattpnolan


    I used this method to create a static front/home page for my site as well as a separate Posts page:

    I did this, because I want to restrict the ENTIRE Posts page to only users in a certain “member” group.

    However, it does not appear to be working. Even though I restricted the access to the Posts page using the Members-plugin settings on that page, all users are able to see that page without any issue.

    I’m guessing this is because the Posts show up on the page via a different method than just publishing content on a page. However, if at all possible, I’d like to show a completely blank page (or page with custom message) instead of showing my posts (i.e. I don’t even want to show post titles to people not in the correct member group).

    Does anyone know how I can fix this? Thank you!

Viewing 11 replies - 1 through 11 (of 11 total)
  • What would work even better is if I could redirect anyone with a “Subscriber” role to one page…and no matter what other page they tried to access, they would just keep getting redirected to the one page that I created with a message to members not yet approved to see any other content…

    This was resolved on the Theme Hybrid forum with a custom plugin.



    Can you post a link to the solution on the Theme Hybrid forum?





    Can you post the solution? $29 for one answer is to much!



    ^blips – yep, thats what I thought.

    Sure. Here is some sample code:

    add_action( 'template_redirect', 'my_redirect' );
    function my_redirect() {
    	if ( current_user_can( 'subscriber' ) || !is_user_logged_in() ) {
    		if ( is_home() || is_front_page())
    			wp_redirect( '' );

    Hi, I have the exact same problem
    Where do I put the code ?

    I try adding it in the membership plugin php, it seemed to do the trick but then it redirected from all the pages (accept the register page) and I wan’t it to redirect ONLY from the post page (so the other pages will work as usuall)




    You could try adding a function in functions.php in your child theme. If you continue to modify the plugin, you might lose the changes if the plugin is updated.

    You can look at focusing this to a post type. (

    I quickly googled for something, and you can try getting more specific with post types, too using something like:

    if (is_archive()) // if displaying any archive
    elseif (is_page()) // if displaying a wp Page (write -> page)
    elseif (is_single()) // if displaying single post
    else // everything else

    I just want the static post page to be restricted, just that
    it seems weird that there’s not plugin that can do that

    Here is a function you can add to your theme’s functions.php file, which is a bit more efficient than doing a redirect:

    Create a page called “Login” (or whatever) using the [wp-members page="login"] shortcode, grab the ID of that page, then pop it into the function on the line that reads:

    $query->set( 'page_id', '12' );

    Replace the number ’12’ with your login page ID and non-members (or members who aren’t logged in) will see the login page instead of the post index.

    This function uses the pre_get_posts action hook to modify the WP_Query object.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Restrict Access to Posts Page’ is closed to new replies.