Not tested but should work
add_action('wp', function() {
$url = home_url('my-profile/'); // profile url here
if(is_user_logged_in()){
if(is_front_page() || is_home()){
wp_redirect($url);
exit;
}
}
});
Edit: I hooked into wp
so the functions in the conditional will work. Add the above snippet of code to your child theme’s functions file, after you edit the $url
on line:2
Related Posts:
- PHP header(Location: …): Force URL change in address bar
- php refresh current page?
- Host the wp-admin on another domain?
- WordPress localhost site redirect to live site
- WordPress Redirect All HTTP requests to HTTPS via .htaccess
- wp_redirect() function is not working
- My wordpress multisite homepage redirects to signup page
- Login redirect to previous page
- Prevent access to single post types
- WordPress install enters an infinite loop
- WordPress HTTPS redirect loop
- 301 redirect not working through .htaccess
- handling login/logout redirects
- Using `auth_redirect` : keeps asking me to login even when I’m logged in
- How can I move/redirect single blog posts from one blog to another?
- 302 redirect instead of 301 after switch to HTTPS
- How do I skip wordpress’s 404 handling?
- Redirecting to home-page when saving any edited code
- Temporary redirect prevents getting $_POST array
- Can WordPress redirect to a “similar page” in case of 404 error
- Hacked website redirect, only on desktop, help with restoring it [closed]
- Can I check for maintenance mode before redirecting to subdomain?
- Moving variables from one page to another
- How to create a 301 redirect that doesn’t apply to subsites
- WordPress blocking/preventing viewing of .cgi file in subdirectory [closed]
- Custom Registration page – prevent redirect to wp-login.php?action=register
- https redirect (with .htaccess) redirect loop
- How to target specific user role?
- How to auto login after registration? [duplicate]
- homepage redirects to login page when user session expires
- How to redirect user to a specific page based on username?
- Redirect blog archive into certain format
- How to publish new posts/pages in root instead of subfolder, but keep old structure in place?
- forward domain name to particular page?
- Contact Form 7 Data to Whatsapp Link
- htaccess 301 Redirect not working for WordPress site
- Auto-detect the redirect url from the original url
- How can I replace my primary url globally with a parked one?
- WordPress Auto-Redirecting on 404
- I need to redirect an entire subdirectory in WordPress to the homepage – is this correct?
- My website on checking showing 403 error on HTTP Status [closed]
- I get redirected too many times only in wp-admin?
- Redirecting Pages That No Longer Exist — But Could in the Future
- How do I determine what is causing a redirect for a given page?
- Trouble running local WordPress in Google App Engine
- Empty folder being created by WordPress, breaks site
- About to migrate site to new domain
- Redirect all users to dashboard unless custom post type
- Redirecting connection from IP to localhost
- WordPress directing to Posts page (edit.php) instead of saving post
- HTML Redirect to WP pages
- How to redirect 40,000 urls with the same url structure efficiently?
- Changing theme = change home page for mobile visitors?
- Redirect User on Login based on role WP 3 – Multi-Site
- production site routes to staging site after cloning
- Redirect old URL (with different post ID) to new URL
- How to redirect an old page url to the homepage
- Custom URL routes
- Delete Redirect Slug For Specific Post
- Duplicated WP site manually, now links redirect wrong [closed]
- redirecting an entire WP site from one top level domain to another
- Load function with login_redirect
- Missing domain http://./wp-… in redirects
- All URLs Redirect to Main Page
- 301 redirects in Headway based WordPress Site
- Why I am not able to direct user to my blog section without login?
- Force User Login
- Import RSS as posts with redirect?
- Parked domain redirecting to wrong error404 page
- Subdomain redirect problem
- redirect from old URL structure
- How to Redirect WordPress domain.com/?anyword to 404 Page?
- How can I prevent caching of wp_redirect?
- Is the default value of FORCE_SSL_ADMIN documented?
- Redirect Category Media ‘URL’ when clicked
- Error in /blog redirection – ubuntu default WP installation
- wordpress automatic URL ‘page’ parameter rewrite
- Changing post depending upon where you’re redirected from?
- Loading /wp-content/uploads/site as /site/
- How to redirect user to the specific URL and display notice
- when contact form7 submited domain redirects to example.com means (example domain)
- WordPress not loggin user and redirecting after custom registration
- How to manage around 90k 301 redirects after migration from old CMS
- Local domain remap with proxy : Infinite 301 redirect, bad URL typo
- How to 301 redirect to subdirectory but keep access to wp-admin of main domain
- Pagination redirect set in .htaccess file is not working
- Count users redirected from Facebook
- Redirecting a POST to a php script
- automaticly redirect link problem on update
- WordPress Login Page redirecting after failed login
- Redirect after empty register form
- Displays url’s twice and getting 404 errors after activating
- Redirect once on first visit
- How to permanent redirect old domain to new one. in case amazon store
- Bookmark anchor link to load another page first before completing?
- How to map secure.domain.com to www.domain.com or domain.com with “WordPress MU Domain Mapping” on the primary multisite domain?
- How to change Ugly link?
- WordPress site redirecting to developers URL
- How to use the HTTP API (wp_remote_get) instead of cURL?
- After migration index page still redirects to old url