Characters you need to escape in the Title of a WordPress post
Posted by jpluimers on 2023/07/18
I forgot to post this: [Wayback/Archive] Which characters need to be escaped in HTML? – Stack Overflow
If you’re inserting text content in your document in a location where text content is expected1, you typically only need to escape the same characters as you would in XML. Inside of an element, this just includes the entity escape ampersand&and the element delimiter less-than and greater-than signs<>:& becomes & < becomes < > becomes >
I didn’t quote further, as this bit is somehow important for WordPress posts. WordPress reminded me the hard way when initially these posts were wrongly titled:
- What is the difference between
<p>,<div>and<span>in HTML&XHTML? (wrongly titled “What is the difference between , and in HTML&XHTML?“)- The text of the Title needed to be escaped into
Another difference between the <p> and <div> element in HTML&XHTML
- The text of the Title needed to be escaped into
- Another difference between the
<p>and<div>element in HTML&XHTML (wrongly titled “Another difference between the and element in HTML&XHTML“)- The text of the title neede to be escaped into
Another difference between the <p> and <div> element in HTML&XHTML
- The text of the title neede to be escaped into
Warning:
It also means the “Press This” bookmarklet always gets unescaped plain text wrong. Watch this when selecting text for blogging and check if the selected text actually got into your post fine.
Thanks [Wayback/Archive] Ahmet for asking the above question and [Wayback/Archive] Jeremy for answering it.
–jeroen
Rate this:
Share this:
- Click to share on Mastodon (Opens in new window) Mastodon
- Click to share on Bluesky (Opens in new window) Bluesky
- Share on Tumblr
- Click to share on Reddit (Opens in new window) Reddit
- Click to share on Threads (Opens in new window) Threads
- Tweet
- Click to share on Telegram (Opens in new window) Telegram
- Click to share on Nextdoor (Opens in new window) Nextdoor
- Click to share on WhatsApp (Opens in new window) WhatsApp
- Click to print (Opens in new window) Print
- Click to email a link to a friend (Opens in new window) Email
Related
This entry was posted on 2023/07/18 at 12:00 and is filed under Development, HTML, HTML5, SocialMedia, Software Development, Web Development, WordPress, WordPress. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
This site uses Akismet to reduce spam. Learn how your comment data is processed.






Leave a comment