Solution to wordpress emoji loading error

Source: Internet
Author: User

After wordpress is upgraded to version 4.2, emoji is added. The facial expression is remotely loaded using the following CDN:

Http://s.w.org/images/core/emoji/7210872/

The problem is that the CDN is slow to access in China, and cannot be accessed in most cases.

If you know the reason, you can solve the problem. Zhiwen studio provides two ideas to solve this problem, which are for reference only.

Solution 1: Change the accessible CDN

After a static resource such as an image is downloaded once, the browser caches the image and loads it again before it expires.
There are a large number of wordpress sites. When users access these sites, they only need to load them once from CDN. The benefits are Needless to say.
The following CDN addresses provided by maxcdn are accessible:
Http://twemoji.maxcdn.com/7210872/
The following CDN provided by bootcss can also be accessed:
Http://cdn.bootcss.com/twemoji/1.4.1/7210872/

Solution 2: use the station expression

If an emoticon image is on your site, it will not be accessible from external addresses. Emoji is shared by the twitter team for free. You can download it from github:

Https://github.com/twitter/twemoji/releases

Download and decompress the directory, and then copy and upload the 72 × 72 directory to your site. Put it in the following path:
/Images/emoji/72 × 72/

Change the emoji Request address

Select a new access path based on any of the above solutions, and then follow these steps.
1. Log on to the background and select "appearance-edit ".

2. Select "template function (functions. php)" on the right side to edit functions. php.
3. What is at the end of the file?> Add the following code before, note that the address should refer to the solution you selected:

// Change the emoji CDN address
Function lzwme_emoji_baseurl ($ url ){
Return set_url_scheme ('// cdn.bootcss.com/twemoji/1.4.1/72x72 /');
// Return set_url_scheme ('// twemoji.maxcdn.com/72x72 /');
// Return set_url_scheme ('/images/emoji/72x72 /');
}
Add_filter ('Emoji _ url', 'lzwme _ emoji_baseurl ');

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: info-contact@alibabacloud.com 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.