Solve the problem of “failed to load” in WordPress plugin:wpemoji “Questions

The day before yesterday, Mr. Jiang saw that “failed to load” appeared when he logged in to WordPress background editor to update the article plugin:wpemoji “Question tip. Then search related problems are not seen, but from the prompt, it should be an error when loading wpemoji, which may be caused by a file not being loaded. How to solve the problem?

First, disable the Emoji function

/**
* Disable the emoji Edit By wpfans.org
*/
function disable_ emojis() {
remove_ action( ‘wp_ head’, ‘print_ emoji_ detection_ script’, 7 );
remove_ action( ‘admin_ print_ scripts’, ‘print_ emoji_ detection_ script’ );
remove_ action( ‘wp_ print_ styles’, ‘print_ emoji_ styles’ );
remove_ action( ‘admin_ print_ styles’, ‘print_ emoji_ styles’ );
remove_ filter( ‘the_ content_ feed’, ‘wp_ staticize_ emoji’ );
remove_ filter( ‘comment_ text_ rss’, ‘wp_ staticize_ emoji’ );
remove_ filter( ‘wp_ mail’, ‘wp_ staticize_ emoji_ for_ email’ );
add_ filter( ‘tiny_ mce_ plugins’, ‘disable_ emojis_ tinymce’ );
}
add_ action( ‘init’, ‘disable_ emojis’ );
/**
* Filter function used to remove the tinymce emoji plugin.
*/
function disable_ emojis_ tinymce( $plugins ) {
if ( is_ array( $plugins ) ) {
return array_ diff( $plugins, array( ‘wpemoji’ ) );
} else {
return array();
}
}

This function is generally not available to users, so we prohibit it.

Second, localization

In some older browsers, WordPress will call the http://s.w.org/images/core/emoji/72×72/ Emoji Emoji emoticons are rendered from the pictures in the directory. It will not load due to network problems. We can localize this directory and replace it with scripts.

/ / Emoji localization edit by wpfans.org
function smilies_ reset() {
global $wpsmiliestrans, $wp_ smiliessearch;
// don’t bother setting up smilies if they are disabled
if (!get_ option(‘use_ smilies’)) {
return;
}
$wpsmiliestrans_ fixed = array(
‘:mrgreen:’ => “xf0x9fx98xa2”,
‘:smile:’ => “xf0x9fx98xa3”,
‘:roll:’ => “xf0x9fx98xa4”,
‘:sad:’ => “xf0x9fx98xa6”,
‘:arrow:’ => “xf0x9fx98x83”,
‘:-(‘ => “xf0x9fx98x82”,
‘:-)’ => “xf0x9fx98x81”,
‘:(‘ => “xf0x9fx98xa7”,
‘:)’ => “xf0x9fx98xa8”,
‘:?:’ => “xf0x9fx98x84”,
‘:!:’ => “xf0x9fx98x85”,
);
$wpsmiliestrans = array_ merge($wpsmiliestrans, $wpsmiliestrans_ fixed);
}
//Replacement of CDN pathway < br > was foundfunction static_ emoji_ url() {
return get_ bloginfo(‘template_ directory’).’/72×72/’;
}
//Let the content and comments of articles support Emoji and disable the messy scripts loaded by Emoji < br > andfunction reset_ emojis() {
remove_ action(‘wp_ head’, ‘print_ emoji_ detection_ script’, 7);
remove_ action(‘admin_ print_ scripts’, ‘print_ emoji_ detection_ script’);
remove_ action(‘wp_ print_ styles’, ‘print_ emoji_ styles’);
remove_ action(‘admin_ print_ styles’, ‘print_ emoji_ styles’);
add_ filter(‘the_ content’, ‘wp_ staticize_ emoji’);
add_ filter(‘comment_ text’, ‘wp_ staticize_ Emoji ‘, 50); / / after converting to an expression, the image is converted to a still image < br > imagesmilies_ reset();
add_ filter(’emoji_ url’, ‘static_ emoji_ url’);
}
add_ action(‘init’, ‘reset_ emojis’);
//Output expression < br > andfunction fa_ get_ wpsmiliestrans(){
global $wpsmiliestrans;
$wpsmilies = array_ unique($wpsmiliestrans);
foreach($wpsmilies as $alt => $src_ path){
$emoji = str_ replace(array(‘&#x’, ‘;’), ”, wp_ encode_ emoji($src_ path));
$output .= ‘<a class=”add-smily” data-smilies=”‘.$alt.'”><img class=”wp-smiley” src=”‘.get_ bloginfo(‘template_ directory’).’/72×72/’. $emoji .’png” /></a>’;
}
return $output;
}

We need to create the / 72×72 / directory under the theme directory, and then download the corresponding emoticon to this directory.

Related Article
how to automatically add tag links to the article

Today, I'd like to share a WordPress SEO optimization tip, which can realize the automatic addition of keyword tags in Read more

WordPress displays the registration time of the login user in the frontend

When using WordPress to build a website, some users want to display the user registration time in the frontend, but Read more

WordPress adds the number of SQL queries at the bottom

An excellent woodpress theme is definitely that the less SQL consulting is used, the better. How can we see how Read more

Some WordPress articles can be seen after comments / replies

If we want to hide part of the content of the article and need the user's comments and replies to Read more

Leave a Reply

Your email address will not be published. Required fields are marked *

*
To prove you're a person (not a spam script), type the security word shown in the picture.
Anti-spam image