Skip to content

Instantly share code, notes, and snippets.

@davidzack
Last active August 16, 2017 17:21
Show Gist options
  • Select an option

  • Save davidzack/194f37444c9d68630308ee416381ef61 to your computer and use it in GitHub Desktop.

Select an option

Save davidzack/194f37444c9d68630308ee416381ef61 to your computer and use it in GitHub Desktop.

Revisions

  1. davidzack revised this gist Feb 20, 2017. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -11,7 +11,8 @@ function my_page_template_redirect()
    'lastName' => $current_user->user_lastname,
    ), $url );

    return $url;
    return $url; //nope
    wp_redirect ($url); //too many redirects...

    exit();
    }
  2. davidzack created this gist Feb 20, 2017.
    19 changes: 19 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    function my_page_template_redirect()
    {
    if( is_front_page() && is_user_logged_in() )
    {

    global $current_user;
    get_currentuserinfo();

    $url = add_query_arg( array(
    'firstName' => $current_user->user_firstname,
    'lastName' => $current_user->user_lastname,
    ), $url );

    return $url;

    exit();
    }
    }
    add_action( 'template_redirect', 'my_page_template_redirect' );