0

Long story short.

In wp-config.php:

define('WP_DEBUG', true);
define('WP_DEBUG_DISPLAY', false);
define('WP_DEBUG_LOG', true);

In the main file of my plugin, in the constructor:

public function __construct(){
    error_log("this is properly logged");   
    add_action( 'wp_logout', array($this, 'logout') ); 
}

Then the logout method:

public function logout(){
    error_log("never logged");          
}

The logout method is never executed. Why?

The whole story

I allow user to signin/signup using OpenID Connect Generic plugin. Locally everything works as expected. On remote server I encountered problem only with logout.

If I manually reach the endpoint related to logout, the session is properly closed on the identity provider. But when user logout from wordpress the endpoint is not reached. Indeed at login, after logout, previous user's session is restored without asking for credentials.

Thinking about an OpenID Connect Generic issue I tried to reach the endpoint programmatically on logout hook. Nothing appens, so I tried to debug putting some error_log in logout method, but they are never executed, so wp_logout hook is never triggered at all. Why?

2
  • Does the OpenID Connect Generic plugin use wp_logout() to log the user out? That appears to be the only function that fires the wp_logout action. You may need to contact the plugin's support team about this.
    – Pat J
    Commented Jan 10, 2022 at 18:28
  • OpenID Connect Generic plugin version and configuration are the same locally and on remote server. The user logout from standard toolbar (wordpress.org/support/article/toolbar). I can't see why there should be difference between local and remote.
    – assistbss
    Commented Jan 11, 2022 at 8:39

1 Answer 1

1

On remote server I disable one by one all plugin not installed locally. Disabling maintenance plugin logout works as expected.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.