Skip to content

Instantly share code, notes, and snippets.

@jmdodd
Created November 30, 2011 00:04
Show Gist options
  • Save jmdodd/1407265 to your computer and use it in GitHub Desktop.
Save jmdodd/1407265 to your computer and use it in GitHub Desktop.
Remove curly quotes on save
<?php
if ( ! function_exists( 'ucc_remove_curly_quotes' ) ) {
function ucc_remove_curly_quotes( $content ) {
$content = str_replace( array( '&#8220;', '&#8221;', '“', '”', '“', '”' ), '"', $content );
$content = str_replace( array( '&#8216;', '&#8217;', '‘', '’', '‘', '’' ), "'", $content );
return $content;
} }
add_filter( 'content_save_pre', 'ucc_remove_curly_quotes' );
add_filter( 'pre_comment_content', 'ucc_remove_curly_quotes' );
/*
Copyright 2011 Jennifer M. Dodd (email: jmdodd@gmail.com)
Released under the GPLv2 (or later).
*/
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment