I’m looking at the code that invalidates inactive admin accounts now. One thing to note is that you can bypass having inactive admin account emails invalidated by setting invalidate inactive admin email after days
to 0. I don’t think this is the ideal solution though.
Admin emails should not be invalidated if the API Key for the admin user has been used within the period of time set by the invalidate inactive admin email after days
setting. Is it possible that on WordPress you have set the Publishing Username to the admin account that is getting deactivated, but for the API Key you are using the All Users API Key? If so, it would make sense that the admin account keeps getting invalidated.
Unless you have a reason to not use the All Users API key on WordPress, you could change the values you have set in the WP Discourse connection settings to use your All Users API Key and your system user’s username. That username defaults to ‘system’.