[wp-trac] [WordPress Trac] #60748: auth_redirect() login check doesn't exist or doesn't work

WordPress Trac noreply at wordpress.org
Mon Mar 11 13:33:05 UTC 2024


#60748: auth_redirect() login check doesn't exist or doesn't work
------------------------------------+------------------------------
 Reporter:  kratosgemini            |       Owner:  (none)
     Type:  defect (bug)            |      Status:  new
 Priority:  normal                  |   Milestone:  Awaiting Review
Component:  Login and Registration  |     Version:
 Severity:  normal                  |  Resolution:
 Keywords:                          |     Focuses:
------------------------------------+------------------------------

Comment (by mujuonly):

 +1

 {{{#!php
 <?php
 add_action( 'wp', function() {
         if ( is_cart() ) {
                 auth_redirect();
         }
 } );
 }}}

 Just checked this as logged in and reloaded the cart page, it logs out and
 redirect to login page.

 This is the function doc

 {{{#!php
 <?php
         /**
          * Checks if a user is logged in, if not it redirects them to the
 login page.
          *
          * When this code is called from a page, it checks to see if the
 user viewing the page is logged in.
          * If the user is not logged in, they are redirected to the login
 page. The user is redirected
          * in such a way that, upon logging in, they will be sent directly
 to the page they were originally
          * trying to access.
          *
          * @since 1.5.0
          */
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/60748#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list