Search code examples
wordpressshortcode

Wordpress Shortcodes Single & Double Quotes Issue


I am adding my shortcodes using custom HTML block in Wordpress Gutenberg editor.

[tagged_heading heading_tag="h2" description="Lorem ipsum <span data-attribute='1'></span> sodales dui."]

After updating the page all works ok, but after reloading editor window all single quotes, in data-attribute for example, changed to double quotes. How I can prevent that?


Solution

  • Found a fast-fix solution, which works for me. Single quotes will stay intact if they are placed on the first level and double quotes inside of the single quotes. So just swap them e.g. [tagged_heading text='Lorem ipsum dolor sit amet <mark data-tooltip="tooltip"></mark> sodales dui.']