On my WordPress site, I’m trying to use a textarea to share image code with visitors to post on their sites. On the backend everything looks good, but copying and pasting from the textarea, it turns the neutral quotation marks (") into directional quotation marks (”) which breaks the links.
Code:
<textarea style="resize: none; margin: 0px; padding: 5px; max-width: 100%; height: 150px; width: 720px;" readonly="readonly">
<a href="https://fdmotion.com">
<img src="https://fdmotion.com/wp-content/uploads/2021/09/banner1.jpg" alt="FDMotion Custom Orthotics" />
</a>
</textarea>
After copy/paste
<a href=”https://fdmotion.com”><img src=”https://fdmotion.com/wp-content/uploads/2021/09/banner1.jpg” alt=”FDMotion Custom Orthotics”></a>
Been looking around, but unable to find any textarea properties that I can change. Any advice?
2
Answers
Try this one:
Without seeing how you’re generating that textarea code it’s tough to say, but WP uses the wptexturize filter to convert quotes into ‘smart’ quotes.
This article helps explain the extent that this filter is used: https://www.webnots.com/4-ways-to-disable-smart-or-curly-quotes-in-wordpress/
To the point, depending on where the content for the textarea is being generated, my guess is that at some point in its creation it’s being run through wptexturize. I’d try adding the following lines to your theme’s functions.php file and see if this disables the smart quotes behavior for you:
This will remove the filter from ALL instances of the_content, the_excerpt, etc, so probably not a final solution. However, it should help us narrow down if the behavior changes, and if so, which filter may’ve been responsible.