• Rick Hellewell

    (@rhellewellgmailcom)


    Latest version of WP-Members (free), latest WordPress.

    Have a page that is set for blocking (default is not blocking) that uses a custom template.

    How do I block access if user not logged in. Have tried this code at the top of the custom template, but does not redirect to login page (login page is set in options) (code as suggested by documentation)


    add_filter( 'wpmem_login_redirect', 'my_login_redirect', 10, 2 );

    function my_login_redirect( ) {
    // return the url that the login should redirect to
    return 'http://www.mysite.com/residents-log-in/';
    }

    All I get is the page without content (headers, footers, widgets, etc.)

    https://wordpress.org/plugins/wp-members/

Viewing 1 replies (of 1 total)
  • Plugin Author Chad Butler

    (@cbutlerjr)

    The filter you added here doesn’t redirect to a login page, it redirects a user when they log in.

    If you are doing this in the actual template file you don’t need a filter or a function for this. You just need to wrap the Loop in some conditional logic that checks to see if the user is logged in using is_user_logged_in()

Viewing 1 replies (of 1 total)
  • The topic ‘Blocking Page with Custom Template’ is closed to new replies.