To disable smart quotes in WordPress, you can use add_filter('run_wptexturize', '__return_false');
in your functions.php
file. But in this tutorial, I will teach you how you can create a WordPress plugin and upload it to the plugin directory to disable entirely smart/curly quotes for your WordPress site.
I recommend creating a plugin instead of adding a line in functions.php
because you may lose the added code on your next theme update if you are not using the child theme. Below are the steps to create a plugin.
Create a Plugin in WordPress to Disable Smart Quotes
Create the following PHP file in a text editor and give the name disable-smart-quotes.php:
disable-smart-quotes.php
<?php /* Plugin Name: Disable Smart Quotes Plugin URI: Description: Disable smart quotes entirely for your WordPress site. Version: 2.0 Author: Vinish Kapoor Author URI: https://vinish.ai */ add_filter('run_wptexturize', '__return_false'); ?>
Create a New Directory under wp-contents > plugins
After that, connect to your WordPress site FTP account and go to wp-contents > plugins
folder and create a directory dsq
.
Upload the disable-smart-quotes.php file
Now upload the disable-smart-quotes.php file from your computer to the wp-contents > plugins > dsq
folder.
Active the Plugin in WordPress
Now come back to your WordPress and click on Plugins > Installed Plugins
.
There you will find your newly created Disable Smart Quotes plugin. Now click on the Active
link to activate the plugin.
There you go. Your WordPress website will now use only straight quotes instead of smart/curly quotes.
Reference: Disabling wptexturize() in WordPress