No plug-in WordPress disables automatic conversion of English half-width symbols to full-width symbols

Source: Internet
Author: User
Tags abstract php file
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.