Archived topic
Mark Smart Quotes Dumb
11 replies · Started by Mary Pearson on March 30, 2018
I assume this is probably a basic WP issue but found so many "solutions" that I wanted to ask people I trust to give me the best advice.
When I type quotes and apostrophes in my titles and posts they show up as dumb/straight quotes in admin but when published they convert to smart quotes. I want them all straight, not smart.
I have tried creating a plugin (per internet instructions) called TurnOffSmartQuotes.php. I activated it but it didn't do anything.
I tried uploading a couple of very old plugins but they didn't work either.
I also have the following code in my functions.php file of my child theme, but again, it doesn't fix the problem.
// Begin - Make Smart Quotes Dumb
function remove_smart_quotes($content) {
$content= str_replace(
array("\xe2\x80\x98", "\xe2\x80\x99", "\xe2\x80\x9c", "\xe2\x80\x9d", "\xe2\x80\x93", "\xe2\x80\x94", "\xe2\x80\xa6"),
array("'", "'", '"', '"', '-', '--', '...'), $content);
$content= str_replace(
array(chr(145), chr(146), chr(147), chr(148), chr(150), chr(151), chr(133)),
array("'", "'", '"', '"', '-', '--', '...'), $content);
return $content;
}
add_filter( 'the_content', 'remove_smart_quotes');
// End - Make Smart Quotes Dumb
An example of a page with smart quotes is https://resources.christiangays.com/coming-out/
How do I make these smart quotes dumb?
Thanks!
It should be as simple as this code:
remove_filter('the_content', 'wptexturize');
Let me know :)
Thanks Tom. Nope. That didn't work either. Please see https://resources.christiangays.com/list-of-everything/
The quotes are not curly, but they are slanted. Are they still considered "smart"? I don't want them slanted.
Hmm, try this:
add_action( 'wp', 'tu_remove_curly_quotes' );
function tu_remove_curly_quotes() {
remove_filter('the_content', 'wptexturize');
}
Still no.
Then you likely have a plugin or function which is re-adding them.
It's possible that they've been pasted into your content as curly as well, instead of being typed?
I will deactivate my plugins to check.
Re pasted into content as curly, that may have been the case, however I then changed them to straight in the backend, but they still show as slanted on the front end.
I'll do the plugin test and get back to you.
I deactivated all plugins and tried switching themes. No change. I still have smart quotes.
Might be worth asking over on WordPress.org. The support team over there might have seen this before.
The code I provided above should work, so something must be preventing it.
Thanks Tom. Will do.
add_filter('run_wptexturize', function(){return false;}, 999);
Did the trick!
Thanks again Tom!
Glad you got it working :)