Will we encounter such a problem? Looking at the complete technical article, there are some problem-solving scripts, but when we add them to our actual use, there will be various errors. In fact, these scripts are not very problematic. It is mainly caused by the automatic conversion of individual symbols into full-width characters, such as commas and semicolons, which may cause errors during running.
For example, when we use a WordPress program, the title and content are automatically converted to full-angle symbols by default. We need to restrict these automatic conversions. Generally, we can use the Quotmarks Replacer plug-in to implement the conversion, however, we can achieve the goal of using as few plug-ins as possible.
First, filter most of the locations to be converted
The code is as follows: |
Copy code |
$ Qmr_work_tags = array (
'The _ title', // title
'The _ content', // content
'The _ excerpt ', // abstract
'Single _ post_title ', // The title of a single article
'Comment _ author', // comment author
'Comment _ text', // comment content
'Link _ description', // The URL description (which has been deprecated but is often used)
'Bloginfo', // blog information
'WP _ title', // website title
'Term _ description', // project description
'Category _ description', // category description
'Widget _ title', // The title of the widget.
'Widget _ text' // widget text
);
Foreach ($ qmr_work_tags as $ qmr_work_tag ){
Remove_filter ($ qmr_work_tag, 'wptexturize ');
}
|
We add the above script to the Functions. Php file of the current topic, and then we can filter out the half-width conversion of the title, content, comments, abstract, and other parts into the full-width content.
2. Select a full range of filtering and conversion
We do not need to prohibit conversion at all locations. Conversion can be disabled as needed.
The code is as follows: |
Copy code |
// Cancel content conversion
Remove_filter ('The _ content', 'wptexturize ');
// Cancel digest conversion
Remove_filter (the _ excerpt ', 'wptexturize ');
// Cancel the conversion of comments
Remove_filter ('comment _ text', 'wptexturize ');
// Cancel title conversion
Remove_filter ('The _ title', 'wptexturize ');
|
We can selectively cancel Conversion. For example, the title, content, abstract, and comment sections we set do not allow full-width conversion.