- This topic has 11 replies, 2 voices, and was last updated 6 years ago by Tom.
-
AuthorPosts
-
March 30, 2018 at 7:17 pm #536724Mary Pearson
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!
March 30, 2018 at 10:16 pm #536782TomLead DeveloperLead DeveloperIt should be as simple as this code:
remove_filter('the_content', 'wptexturize');
Let me know ๐
March 31, 2018 at 8:54 am #537204Mary PearsonThanks 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.
March 31, 2018 at 8:56 am #537205TomLead DeveloperLead DeveloperHmm, try this:
add_action( 'wp', 'tu_remove_curly_quotes' ); function tu_remove_curly_quotes() { remove_filter('the_content', 'wptexturize'); }
March 31, 2018 at 8:57 am #537208Mary PearsonStill no.
March 31, 2018 at 8:59 am #537210TomLead DeveloperLead DeveloperThen 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?
March 31, 2018 at 9:01 am #537215Mary PearsonI 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.
March 31, 2018 at 3:58 pm #537455Mary PearsonI deactivated all plugins and tried switching themes. No change. I still have smart quotes.
March 31, 2018 at 8:23 pm #537534TomLead DeveloperLead DeveloperMight 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.
March 31, 2018 at 8:38 pm #537540Mary PearsonThanks Tom. Will do.
March 31, 2018 at 9:24 pm #537547Mary Pearsonadd_filter('run_wptexturize', function(){return false;}, 999);
Did the trick!
Thanks again Tom!
March 31, 2018 at 9:46 pm #537558TomLead DeveloperLead DeveloperGlad you got it working ๐
-
AuthorPosts
- You must be logged in to reply to this topic.