Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved]The redirect which takes logged in users away from site root page


  • Henry
    Member

    @henrywright-1

    I’m thinking of having a page of blog posts on the root page of my site for logged in members example.com

    The thing is, there is a redirect in place which takes members away from example.com when they are logged in.

    Would it cause any problems if I disabled this redirect?

Viewing 2 replies - 1 through 2 (of 2 total)

  • @mercime
    Keymaster

    @mercime

    there is a redirect in place which takes members away from example.com when they are logged in.


    @henrywright-1
    Redirecting logged in members away from home page is not default behavior, so not sure why it’s happening in your installation – plugin scripts?


    Henry
    Member

    @henrywright-1

    @mercime I should have added more info

    It is default behaviour when the WP static front page is set to “Register”. I actually came up with a way of doing what I needed with the help from folks over at Stack Overflow:
    http://stackoverflow.com/questions/20039607/different-wordpress-front-page-for-logged-out-and-logged-in-users

    My final code after some minor tweaks to the accepted answer is:

    function bp_custom_front_page() {
    	if ( ! is_admin() ) {
    		if ( is_user_logged_in() ) {
        		$page = get_page_by_title( 'Contact' );
        		update_option( 'page_on_front', $page->ID );
        		update_option( 'show_on_front', 'page' );
    		} else {
       			$page = get_page_by_title( 'About' );
        		update_option( 'page_on_front', $page->ID );
        		update_option( 'show_on_front', 'page' );
    		}
    	}
    }
    add_action( 'init', 'bp_custom_front_page' );
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved]The redirect which takes logged in users away from site root page’ is closed to new replies.
Skip to toolbar