How to redirect members to their own profile entry after login
By default, when a member signs in to your site, WordPress sends them to its admin area. For a member directory, that is rarely what you want. A more useful destination is the member’s own profile entry: the entry they created on registration.
This article walks through how to set that up. There are two pieces:
- A “My Profile” page that shows whichever member is logged in.
- A login redirect that sends members to that page.
Before you start #
You’ll need:
- A member directory View built on your Gravity Forms registration form.
- GravityView Pro, which includes the Advanced Filter extension.
- The Gravity Forms User Registration Add-On configured to create a WordPress user for each registration. GravityView automatically links each registration entry to the user it creates.
1. The “My Profile” page #
Duplicate your directory View; call the copy “My Profile” or whatever you like. Open its Filter & Sort tab and add an Advanced Filter condition: Created By is Currently Logged-in User. Save. The copy inherits your directory’s form and Single Entry Layout, so nothing else to design.
If you want the “My Profile” page to look different from a directory entry, customize the Single Entry Layout in the copy.
Create a regular WordPress page. Title it “My Profile” or anything you like; the URL slug becomes the path, e.g. /my-profile/. In the page content, add a Shortcode block with the [gventry] shortcode:
[gventry view_id="YOUR_VIEW_ID" entry_id="first"]Replace YOUR_VIEW_ID with the ID of the copy you just made. You can find the View ID by going to Views in the WordPress admin and editing the View; the ID is the number after post= in the URL.
Save the page and note its URL; the login redirect below needs it.
Why this works
The [gventry] shortcode renders one entry using the View’s Single Entry layout. The entry_id="first" argument tells it to grab the first entry the View returns. Because the View is filtered to “Created By is Currently Logged-in User”, the only entries it returns are ones the visitor created. “First” of that filtered set is their own entry.
So Alice visits /my-profile/ and sees her own entry. Bob visits the same URL and sees his. Same URL, different content per visitor, no per-user URLs needed.
If you want members to be able to edit their profile, add a Link to Edit Entry field inside your View’s Single Entry layout.
2. Send members to the page after they log in #
The redirect is the piece outside GravityView. Pick the option that matches how members sign in on your site.
Gravity Forms Login widget
If you have placed the Gravity Forms Login widget on your site, open its settings and set the Login Redirect URL field to the URL of your “My Profile” page. The widget redirects users there on successful login.
See User Registration Add-On Login Widget on the Gravity Forms docs site.
Gravity Forms login shortcode
If you’re using the Gravity Forms login shortcode on a page, pass the URL through the login_redirect attribute:
[gravityform action="login" login_redirect="https://yoursite.com/my-profile/"]See Login Form Shortcode on the Gravity Forms docs site.
Standard WordPress login screen
If your members sign in through the standard WordPress login screen at /wp-login.php, neither of the two options above applies to that path. The cleanest no-code option for that case is the LoginWP plugin (formerly Peter’s Login Redirect). After activating it, add a rule for the role your registered members get (usually Subscriber) pointing to your “My Profile” page URL.
Note: the free version of LoginWP only intercepts the standard WordPress login screen. It doesn’t intercept Gravity Forms login widget or shortcode submissions. Those have their own redirect setting, documented above.
Handling logged-out visitors #
If a logged-out visitor lands on the “My Profile” page, the Advanced Filter returns no entries and they see a blank space where the profile should be.
Options to handle this:
- Restrict the page to logged-in users with the free WordPress Members plugin or Redirection.
- For developers, the
gravityview/shortcodes/gventry/outputfilter overrides the output for logged-out users.
Test it #
Log in as a non-admin test user in an incognito window. Admin accounts behave differently from regular members, so this only validates with a regular member account.