A user that clicks the (default) WordPress logout link will also be logged out from Microsoft 365. To achieve this the user will be redirected to a Microsoft logout page so that cookies etc. will be deleted. After doing so successfully, Microsoft will optionally redirect to a URL that you can customize.
For further technical details please refer to the Configuration documentation https://docs.wpo365.com/article/89-microsoft-365-logout.