WP misreading HTML code placed within comments

Here’s another WP newbie question:

I’m trying to put HTML comments around some existing code and something about the closing angle bracket used by the code is causing WP to read the two hyphens in the closing comment as an en dash, which, of course, is breaking everything.

In other words, I can do this with no trouble:

<!-- <p -->

But as soon as I do this, WP no longer sees the closing comment tag - thinks it’s an en dash:

<!-- <p> -->

What could be causing this? And how can I fix it so I can comment code when I need to?

Are you using the text editor or visual editor? Use the text editor.

I always use the text editor. I’m pasting in existing HTML code that I’m trying to move to WP.

It is a wordpress bug you need to use second dummy HTML comment tag like below one.

<!-- <p> --><!-- -->