How does Discourse replace WP comments exactly?

This option has been added to the plugin in version 2.0.7. It is available in the WordPress repo now.

When you select the plugin’s Enable Discourse Comments option, you will now see three options for comment types:

Select the “Display comments for public topics” option to only have comments displayed for topics that are in public Discourse categories. If a topic is published to a private category, a link to the topic and its comment count will be displayed.

If a topic that has been published from WordPress to Discourse is moved from a public to a private category on Discourse, comments will be removed from WordPress and replaced with a link. This change will take up to 10 minutes to occur because the WP Discourse plugin caches comment data that’s returned from Discourse. You can break the category cache immediately by selecting the Force Category Update option from the plugin’s Publishing Settings page and saving that settings page.

To allow the plugin to access category permissions for Discourse subcategories, you need to select the Display Subcategories option from the plugin’s Publishing Settings tab. If that option is not enabled and the “Display comments for public topics” option has been enabled, subcategories on Discourse will all be considered to be private and a link will be displayed instead of comments.

Note: having the plugin recognize category changes that are made directly on Discourse only available if your site is on a recent version of Discourse.

To programmatically control which users have Discourse comments displayed for them, you can completely bypass loading the WP Discourse comments for a user with the wpdc_load_comments_template_for_user filter hook. That hook is passed three arguments: $load_template (defaults to true), $current_user, and $post_id. Return false from a function that hooks into the filter to prevent comments from being loaded for a particular user.