Support » Plugins » Hacks » how to Permissions access user not login?

  • how to redirect all non-authenticated users only for link more content and single page website?

    for all page website

    function protect_whole_site() {
        if ( !is_user_logged_in() ) {
            auth_redirect();
        }
    }
    
    add_action ('template_redirect', 'protect_whole_site');

    change on functions.php.That’s not nice.
    Help me please.
    Any help would be appreciated! Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Performing a redirect
    Following example will redirect all non-authenticated users to a custom ‘signup’ page when trying to visit the ‘goodies’ page.

    function my_page_template_redirect()
    {
        if( is_page( 'goodies' ) && ! is_user_logged_in() )
        {
            wp_redirect( home_url( '/signup/' ) );
            exit();
        }
    }
    add_action( 'template_redirect', 'my_page_template_redirect' );

    Don’t forget to exit() (or die()) after a wp_redirect().

    I found …
    The following code is the same thing that’s helped me and you have questions that you would like.

    function my_page_template_redirect()
    {
        if( the_content("More...") && ! is_user_logged_in() )
        {
            auth_redirect();
            exit();
        }
    }
    add_action( 'template_redirect', 'my_page_template_redirect' );

    Don’t forget to exit() (or die()) after a wp_redirect().

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘how to Permissions access user not login?’ is closed to new replies.