[Resolved] Mark Smart Quotes Dumb

Home Forums Support [Resolved] Mark Smart Quotes Dumb

Home Forums Support Mark Smart Quotes Dumb

  • This topic has 11 replies, 2 voices, and was last updated 6 years ago by Tom.
Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #536724
    Mary 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!

    #536782
    Tom
    Lead Developer
    Lead Developer

    It should be as simple as this code:

    remove_filter('the_content', 'wptexturize');

    Let me know ๐Ÿ™‚

    #537204
    Mary Pearson

    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.

    #537205
    Tom
    Lead Developer
    Lead Developer

    Hmm, try this:

    add_action( 'wp', 'tu_remove_curly_quotes' );
    function tu_remove_curly_quotes() {
        remove_filter('the_content', 'wptexturize');
    }
    #537208
    Mary Pearson

    Still no.

    #537210
    Tom
    Lead Developer
    Lead Developer

    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?

    #537215
    Mary Pearson

    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.

    #537455
    Mary Pearson

    I deactivated all plugins and tried switching themes. No change. I still have smart quotes.

    #537534
    Tom
    Lead Developer
    Lead Developer

    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.

    #537540
    Mary Pearson

    Thanks Tom. Will do.

    #537547
    Mary Pearson

    add_filter('run_wptexturize', function(){return false;}, 999);

    Did the trick!

    Thanks again Tom!

    #537558
    Tom
    Lead Developer
    Lead Developer

    Glad you got it working ๐Ÿ™‚

Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.