How to disable smart quotes in WordPress
WordPress auto corrects Straight Quotes (single and double) to Curly or Smart Quotes. Although it looks good and typographically correct, but it doesn't work when used as Programming CODE or Commands.
We can resolve this by installing a wordpress plugin created by ''http://www.fayazmiraz.com".
Step-1: Create a new file called disable-smart-quotes.php and use the following CODE:
<?PHP
/*
Plugin Name: Disable Smart Quotes
Plugin URI: http://www.fayazmiraz.com/disable-auto-curly-quotes-in-wordpress/
Description: WordPress Plugin to Disable auto Smart (Curly) quote conversion
Version: 1.0
Author: Fayaz Ahmed
Author URI: http://www.fayazmiraz.com/
*/
if( version_compare ( $wp_version, '4.0' ) === -1 ) {
// To Disable Smart Quotes for WordPress less than 4.0
foreach( array(
'bloginfo',
'the_content',
'the_excerpt',
'the_title',
'comment_text',
'comment_author',
'link_name',
'link_description',
'link_notes',
'list_cats',
'nav_menu_attr_title',
'nav_menu_description',
'single_post_title',
'single_cat_title',
'single_tag_title',
'single_month_title',
'term_description',
'term_name',
'widget_title',
'wp_title'
) as $sQuote_disable_for )
remove_filter( $sQuote_disable_for, 'wptexturize' );
}
else {
// To Disable Smart Quotes for WordPress 4.0 or higher
add_filter( 'run_wptexturize', '__return_false' );
}
Step-2: Then upload this file to the following directory:
Your_WordPress_Installation_Folder/wp-content/plugins/
Step-3: Then, login to your WordPress Admin Panel from Your_WordPress_URL/wp-admin/ » go to Plugins menu » activate this new plugin named Disable Smart Quotes
At this point, your WordPress Smart Quotes are Disabled and WordPress will no linger automatically convert straight (single or double) quotes into curly (single or double) quotes or smart quotes.
Once again thanks to "http://www.fayazmiraz.com" for the wonderfull plugin.