I’m pretty sure you can use the API to mark someone in Discourse as inactive kinda like the pseudo-code below.
if ( $wordpress_membership_status == 'inactive' )
$url = $url_base.'admin/users/'.$discourse_userid.'/deactivate.json?'.$api_auth;
else if ( $wordpress_membership_status == 'active' )
$url = $url_base.'admin/users/'.$discourse_userid.'/activate.json?'.$api_auth;
$ch=curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
$response = curl_exec($ch);
Disclaimer: There’s probably (usually) is a better way to do things than the way I do them!
But perhaps this is helpful.
We have code in place such as the above but I haven’t checked lately if it’s still working.