Lao Zuo didn't notice this problem in the blog before. If there are single and double quotation marks in the script shared in the blog post. Everyone knows that only English characters can be used. When I input and write an article, I swear to God that it must be in English status, because I can use it in tests. But when we use the foreground copy and paste, it becomes Chinese character format. I didn't notice until today's "rising sea and bright moon" netizen asked me this question.
If you know that this problem can be solved, you can replace it manually. If you paste it directly, you will not notice this problem, so this problem needs to be solved. The following are three ways to solve the problem of outputting single and double quotation marks into Chinese characters in WordPress code.
One method is to modify the functions.php template file with one sentence of code
remove_filter('the_content', 'wptexturize');
This method is not bad. It simply does not need to install the plug-ins mentioned below, and it will not affect the upgrade of WP programs. This sentence is used to prohibit the wptexturize function. It can only be valid in the content, and the title, comment, etc. are not valid.
The second method is the Quota Replacer plug-in
The Quotmarks Replacer plug-in is downloaded and installed from the WP official. It is also used to prohibit the wptexturize function and the conversion of half width single and double quotation marks to full width format. Try to install as few plug-ins as possible, but this plug-in is relatively small, so it's OK to install it.
Method 3: Modify the program source file
Modify the wp includes/formatting. php file to find the following code
// static strings
$curl = str_replace($static_characters, $static_replacements, $curl);
// regular expressions
$curl = preg_replace($dynamic_characters, $dynamic_replacements, $curl);
Modify to
// static strings
// $curl = str_replace($static_characters, $static_replacements, $curl);
// regular expressions
// $curl = preg_replace($dynamic_characters, $dynamic_replacements, $curl);
Log off the code function. This method needs to pay attention to whether it is updated when upgrading the program, and then it needs to be modified again.
From the effect of the three methods, Lao Zuo suggested using the first method.