This will happen if the login required setting is enabled on your Discourse site. To get users logged out of Discourse, they also need to be logged out of the WordPress site. To log users out of WordPress, set the Discourse logout redirect site setting to https://example.com/?request=logout, with your domain name substituted for example.com.