Solve the problem that English single and double quotes become Chinese characters when copying wordpress code

Original link: https://www.xujiahua.com/10066.html

Why in wordpress, the English quotation marks in the article are obviously in English, but the copied English quotation marks are not in English, but in Chinese?

In particular, we look for solutions to some problems in other people’s blogs.

And bloggers, such as diary brother, provide some codes to solve the problem.

However, many people copied the code from the webpage, only to find that all the quotation marks in the code became Chinese quotation marks.

The reason Diary brother thinks is also very simple. Although the quotes used in the code written by the bloggers are all in English, their blogs and the language of their wordpress installation are all in Chinese.

So it is easy to cause this problem.

And the solution is very simple:

Modify the template:

Add a sentence in the functions.php of the theme:

remove_filter(‘the_content’, ‘wptexturize’);

that’s it.

In this way, when fans of your blog copy the code of your blog, there will be no such problem of English quotation marks changing to Chinese quotation marks.

Please indicate when reprinting: Diary Boy’s Blog » Solve English single and double quotation marks into Chinese characters when wordpress copy code

This article is transferred from: https://www.xujiahua.com/10066.html
This site is only for collection, and the copyright belongs to the original author.