It’s not as simple as just calling the logout_from_discourse() function, but it should be possible to use a WordPress action hook to call that function when a specific action is called on your WordPress site. For example, when a user’s membership level is revoked. Possibly someone in the Discourse community can help you with the syntax that is needed to make that work.