Tutorial Shares
  • Home
  • Tutorials
  • Categories
  • My Favorites
  • Terms of Use
  • WordPress
    • Theme Customizations
    • Security
    • Admin Dashboard
  • Magento
  • Code Snippets
  • Hosting
  • CSS
  • Dev Tools
  • Hosting
    • Hosting
    • Nginx
    • Ubuntu
    • Linux
  • Design
  • PHP

Redirect to Previous Page After WP Login or Register

Jan 30, 2025 by Christine Cardoso in Wordpress Loading 628

To redirect back to the previous page after a WordPress user logs in or registers for a new account, insert get_permalink() in the wp_login_url() function. After filling out the form, you will no longer be redirected to the wordpress dashboard, but to the previous page.

1
<?php echo '<a href="'.wp_login_url(get_permalink()).'" title="Login">Login</a>'; ?>

 

1
<?php echo '<a href="'.wp_registration_url(get_permalink()).'" title="Login">Login</a>'; ?>

 

Share this:

  • Google
  • Twitter
  • Pinterest
  • Print
  • Email
  • Commandrea

    THANK YOU!!!

Recent Posts

  • Change WordPress Multisite Primary Domain on Trellis Bedrock Install
  • List all database MySQL command
  • Morgan Stanley’s Photographer Shares 6 Tips for Taking a Professional Headshot
  • WP-Stateless – Google Cloud Storage
  • Media Cloud by ILAB

Community Favorites

  • Custom admin column for WP categories & taxonomies (1334)
  • Show All Categories and their Posts in Wordpress (1302)
  • Add color picker to wordpress admin metafield (1251)
  • Fix nav menu active classes for custom post types (1198)
  • Contact Form 7 + Bootstrap Example (1188)

Tags

archive.php bower Category Archives cli command line composer Customize WP custom metaboxes custom meta fields Custom Page Template Custom Post Type Archives Custom Post Types DevOps digital ocean featured image frontend git GoDaddy google cloud Gulp linux commands load Magento 2 Nginx node.js NPM Page Templates Pagination Password Protect Permalinks Roots.io Roots Theme Sage scale wordpress server admin sysadmin Terminal trellis typography Ubuntu 14.04 usermod Wordpress Wordpress hacks Wordpress plugins WP Admin Dashboard

© 2018 TutorialShares.com. Brought to you by Digimix, a WordPress Development Company.

loading Cancel
Post was not sent - check your email addresses!
Email check failed, please try again
Sorry, your blog cannot share posts by email.