WordPress.org

Ready to get started?Download WordPress

Forums

Replace curly quotes with straight quotes (1 post)

  1. gsmdude
    Member
    Posted 3 years ago #

    I'm trying to replace curly quotes. I added the following to my theme's function.php but it doesn't seem to be working? Any ideas? Thanks.

    function removesmartquotes($content) {
    $content = str_replace("“", """, $content);
    $content = str_replace("”", """, $content);
    $content = str_replace("‘", "'", $content);
    $content = str_replace("’", "'", $content);
    $content = str_replace("″", """, $content);

    $content = str_replace("“", """, $content);
    $content = str_replace("”", """, $content);
    $content = str_replace("‘", "'", $content);
    $content = str_replace("’", "'", $content);
    $content = str_replace("—", "--", $content);
    $content = str_replace("…", "...", $content);

    return $content;
    }
    add_filter('the_title', 'removesmartquotes');
    add_filter('the_excerpt', 'removesmartquotes');
    add_filter('the_content', 'removesmartquotes');

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags