WordPress automatically replaces ‐‐ with the long dash –. But for technical text, you often need the double minus symbol, e.g., when writing scripts and command line flags such as –option.
💬 How to prevent WordPress from replacing the double hyphen (minus) with the long dash?
Here’s the surprisingly simple fix:
You can simply edit the WordPress Block where the double hyphen arises as HTML and replace it with the character sequence ‐‐
or write ‐‐
.
Copy either of the following sequences in your WordPress editor to write the double hyphen:
‐‐ ‐‐
This character sequence is the Hyphen HTML Code:

💡 Info: Copying this Hyphen HTML code in the WordPress editor works for paragraphs but also for post titles and excerpts and most other WordPress block elements.
For more ways to accomplish this less elegantly, feel free to check out this excellent guide.

While working as a researcher in distributed systems, Dr. Christian Mayer found his love for teaching computer science students.
To help students reach higher levels of Python success, he founded the programming education website Finxter.com that has taught exponential skills to millions of coders worldwide. He’s the author of the best-selling programming books Python One-Liners (NoStarch 2020), The Art of Clean Code (NoStarch 2022), and The Book of Dash (NoStarch 2022). Chris also coauthored the Coffee Break Python series of self-published books. He’s a computer science enthusiast, freelancer, and owner of one of the top 10 largest Python blogs worldwide.
His passions are writing, reading, and coding. But his greatest passion is to serve aspiring coders through Finxter and help them to boost their skills. You can join his free email academy here.