How to Redirect a WordPress User to the Original Post After Login

How to Redirect a WordPress User to the Original Post After Login thumbnail
WordPress allows you to specify the landing page after sign in.

The feature that allows site registration and member logins make WordPress a platform you can use to create community-driven sites. Although WordPress comes with a ready-to-use widget for site login, this default link sends the user straight to the administration login page. If you have a self-hosted WordPress site, you can easily create a login page set to automatically redirect to a page of your choice -- such as a member landing page or your own home page.

Instructions

    • 1

      Open a new file in Notepad.

    • 2

      Type in the name of your login template:

      <?php

      /**

      * Template Name: Member Login Page

      *

      */

      ?>

    • 3

      Add the WordPress login form function with the redirect URL specified:

      <?php

      wp_login_form('redirect=http://mysite.com/members-area/');

      ?>

      Replace "mysite.com/members-area/" with the URL where you want users to be directed after they log in.

    • 4

      Save the page as "loginform.php."

    • 5

      Upload the file to your WordPress theme's folder via an FTP program.

    • 6

      Log in to your WordPress site.

    • 7

      Create a page using your "Member Login Page" template. Click on "Pages" and "Add New." Enter a title for your page, select "Member Login Page" from the drop-down menu for "Template" and save your page.

    • 8

      Click on the "View Page" button to view and test out your login page.

Tips & Warnings

  • You can add your site header, footer and sidebar on the Member Login Page template by adding the WordPress functions get_header(), get_footer() and get_sidebar().

Related Searches:

References

  • Photo Credit Hemera Technologies/AbleStock.com/Getty Images

Comments

You May Also Like

Related Ads

Featured