thank you for your help, but problem is that there are comments left on the existing site and I need to get the number of existing comments, comments on Discourse and add them up. Is it possible to do this?
If you’re looking to get the total of Wordpress and Discourse comments for a single post, then get_comments_number() will work (i.e. it will return the sum of both).
If you’re looking to get a sum total of all comments on your site (not from a specific post), whether from Wordpress or Discourse, this is a somewhat subjective question. It depends what you mean by “all comments”. You’ll need to write a custom function for this, and would do if you were just counting Wordpress comments by themselves. You’d do something like this and use it in a shortcode or block
(I just wrote this on the fly so please test it before you use it )
Note that I’ve chosen to return the approved Wordpress comment count and the count of Discourse comments on published posts. There are other choices you could make there about what qualifies for your count.