Wednesday, January 25, 2023
HomeWordPress Developmentlogin - Preserve loging out

login – Preserve loging out


I’m making an attempt to create a branded login customized login and registration web page. Utilizing twig templates to name the login_form variable to show the shape if the person is not logged in outlined by the next code:

if (!is_user_logged_in()) {
   $args = array(
      'echo'            => false,
      'redirect'        => get_permalink(),
      'form_id'         => 'loginform',
      'label_username'  => __( 'Username:' ),
      'label_password'  => __( 'Password:' ),
      'label_remember'  => __( 'Bear in mind Me' ),
      'label_log_in'    => __( 'Log In' ),
      'bear in mind'        => true
   );
   $context['login_form'] = wp_login_form( $args );
}

Nonetheless, so long as this code is current within the construct any web page navigation logs the person out, and in case you are within the admin part any navigation takes you to the login web page. I’ve been trying round and the frequent response is to go to settings and ensure WordPress Handle (URL) and Web site Handle (URL) are the identical. They already are, and this does not occur if I haven’t got this operate name, even when I by no means go to the web page with this code it nonetheless breaks the entire login logic website vast. Any concepts? This has been driving me loopy for a couple of days now and I am unable to determine what could possibly be inflicting such weird conduct.

Additional, I feel the decision to is_user_logged_in() logs me out. Any web page with that decision on it appears to log me out silently. So if I remark out the wp_login_form line, I keep signed in till I hit this web page once more after which I get logged out.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments