Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

Så här inaktiverar du emojis i WordPress (steg för steg)

Vill du inaktivera emojis på din WordPress site?

Emojis är små icons som används för att uttrycka känslor eller expressioner. WordPress hämtar ytterligare CSS och en JavaScript-fil för att add to emoji-stöd, så vissa användare kanske vill ta bort det för att förbättra sidans hastighet och prestanda.

I den här artikeln kommer vi att visa dig hur du enkelt inaktiverar emojis i WordPress, steg för steg.

How to disable emojis in WordPress 4.2

Vad är emojis?

Emojis är de små icons eller smileys som används på internet.

Emojis, som ursprungligen kommer från Japan, har tagit sig in i Unicodes teckenuppsättning och stöds nu av såväl stationära datorer som iOS- och Android-mobila enheter.

Den här funktionen introducerades först i WordPress 4.2 och det främsta skälet till att lägga till den var att add to native support för kinesiska, japanska och koreanska teckenuppsättningar.

Emojis example

Som standard hämtar din website i WordPress en extra JavaScript-fil och lite CSS för att add to support för emoji.

You can see it by viewing your website’s source code or by using the Inspect tool.

Emoji JavaScript in WordPress

Vissa webbplatsägare kanske dock vill inaktivera detta extra stöd för emoji för att öka WordPress laddningshastighet och prestanda genom att ej ladda ner ytterligare kod och skript.

Note: När vi säger att vi inaktiverar emojis i WordPress menar vi att vi inaktiverar de extra checks och skript som WordPress använder för att hantera emojis. Du kan fortfarande använda emojis på din site, och de webbläsare som stöder dem kommer fortfarande att kunna visa dem.

Med detta sagt, låt oss ta en titt på hur du enkelt inaktiverar stöd för emoji i WordPress.

Metod 1. Inaktivera emojis i WordPress med hjälp av kod

För den här metoden kommer vi att använda ett custom code snippet för att inaktivera support för emoji i WordPress.

You can add this code snippet to your WordPress theme’s functions.php file or a site-specific plugin. Ett litet error i koden kan dock lätt förstöra din website och göra den otillgänglig.

För att undvika detta rekommenderar vi att du använder WPCode. Det är det bästa WordPress code snippets plugin på marknaden som erbjuder det säkraste sättet att lägga till custom code till din site utan att bryta den.

Först måste du installera och aktivera pluginet WPCode. För mer instruktioner, se vår guide för nybörjare om hur du installerar ett plugin för WordPress.

Efter aktivering besöker du Code Snippets ” + Add Snippet page från WordPress adminpanel. Härifrån går du till alternativet ”Add Your Custom Code (New Snippet)” och klickar på knappen ”Use Snippet”.

Add new snippet

Detta tar dig till sidan ”Create Custom Snippet” där du kan börja med att skriva ett namn för ditt code snippet. Det kan vara vad du gillar.

Därefter väljer du ’PHP Snippet’ som din ’Code Type’ från dropdown-menyn i det högra hörnet av vyn.

Type a name for your code snippet and choose PHP as code type

Nu är allt du behöver göra att copy and paste följande kod i boxen ”Code Preview”:

/**
 * Disable the emoji's
 */
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_filter( 'wp_resource_hints', 'disable_emojis_remove_dns_prefetch', 10, 2 );
}
add_action( 'init', 'disable_emojis' );

/**
 * Filter function used to remove the tinymce emoji plugin.
 * 
 * @param array $plugins 
 * @return array Difference betwen the two arrays
 */
function disable_emojis_tinymce( $plugins ) {
 if ( is_array( $plugins ) ) {
 return array_diff( $plugins, array( 'wpemoji' ) );
 } else {
 return array();
 }
}

/**
 * Remove emoji CDN hostname from DNS prefetching hints.
 *
 * @param array $urls URLs to print for resource hints.
 * @param string $relation_type The relation type the URLs are printed for.
 * @return array Difference betwen the two arrays.
 */
function disable_emojis_remove_dns_prefetch( $urls, $relation_type ) {
 if ( 'dns-prefetch' == $relation_type ) {
 /** This filter is documented in wp-includes/formatting.php */
 $emoji_svg_url = apply_filters( 'emoji_svg_url', 'https://s.w.org/images/core/emoji/2/svg/' );

$urls = array_diff( $urls, array( $emoji_svg_url ) );
 }

return $urls;
}

Därefter rullar du ner till ”Insertion” section och väljer läget ”Auto Insert”.

Koden kommer nu att aktiveras automatiskt på din site vid aktivering.

Choose an insertion method

Därefter går du tillbaka högst upp och togglar omkopplaren till höger från ”Inaktiverad” till ”Aktiv”.

Slutligen klickar du på knappen ”Save Snippet” för att spara dina ändringar.

Click the Save Snippet button to save changes

Alltså har du utan problem inaktiverat emojis i WordPress.

Metod 2. Inaktivera emojis i WordPress med hjälp av ett plugin

Om du inte vill add to kod till din website, då är den här metoden något för dig.

Först måste du installera och aktivera pluginet Disable Emojis. Se vår guide om hur du installerar ett plugin i WordPress för mer instruktioner.

Pluginet fungerar direkt från boxen och det finns inga inställningar som du behöver konfigurera.

När den aktiveras inaktiverar den automatiskt support för emoji från din WordPress site vilket förbättrar sidans laddningshastighet.

Bonus: Add Reaction Buttons till dina WordPress Posts

Även efter att ha inaktiverat support för emoji kanske du vill allow användare att reagera på dina posts och dela med sig av sina åsikter genom reaktionsknappar.

Dessa knappar kan öka engagemanget på din WordPress blogg och öka interaktionen med användarna.

För att göra detta måste du installera och aktivera pluginet WP Reactions Lite. För detaljer, se vår guide för nybörjare om hur man installerar ett plugin för WordPress.

Vid aktivering, besök WP Reactions ” Global Activation page från WordPress dashpanelen och toggle Reactions-omkopplaren till ON.

Toggle the Reactions Switch to the ON Position

Efter det kan du klicka på knappen ”Customize” och välja de olika uppsättningar emojis som du vill add to som dina reaktionsknappar.

Du kan sedan konfigurera deras placeringsalternativ, storlek och CTA med pluginet.

Set Up Your Reaction Buttons

När du är klar klickar du bara på knappen ”Save & Exit” för att spara dina Settings.

Nu kan du besöka din WordPress site för att view reaktionsknapparna i action. För mer information, se vår tutorial om hur du lägger till WordPress reaktionsknappar för att öka engagemanget.

WordPress Reaction Buttons Preview

Vi hoppas att den här artikeln hjälpte dig att lära dig hur du inaktiverar Emojis på din WordPress-webbplats. Du kanske också vill kontrollera vår Step-by-Step-guide om hur du skapar ett custom Facebook Feed i WordPress och vår artikel om hur du add to web push notifications till din WordPress-webbplats.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Avslöjande: Vårt innehåll stöds av våra läsare. Det innebär att om du klickar på några av våra länkar, kan vi tjäna en provision. Se hur WPBeginner finansieras, varför det är viktigt, och hur du kan stödja oss. Här är vår editoriala process.

Avatar

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

Den ultimata WordPress-verktygslådan

Få GRATIS tillgång till vår verktygslåda - en samling WordPress-relaterade produkter och resurser som varje professionell användare bör ha!

Reader Interactions

31 kommentarerLämna ett svar

  1. Syed Balkhi says

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. Natalie says

    If you are already using the Yoast SEO plugin then it has an in-built option to disable emoji so you don’t need to install another plugin for that.
    The option is under advanced / crawl optimization

  3. Jiří Vaněk says

    I would like to ask. Does banning emoji really have any significant effect on increasing website speed? I’m working on speed for one site, but the requirement was to keep the emoji on. Is it actually worth turning off emoji?

    • WPBeginner Support says

      It would not be a major performance increase, it would mainly affect speed for sites looking to maximize the improvements possible for as short of a load time as possible.

      Administratör

      • Jiří Vaněk says

        Thanks for the reply, that’s what we were looking for. Get the highest possible speed results from the site. We will turn off the emoji and measure. Anyway, thanks for the advice.

  4. Jiří Vaněk says

    At first, I tended to disable emojis on my website. Since I’ve been using AIO SEO, I actually use emojis in SEO because it’s interesting to see how a title in SERP can grab more attention at first glance with emojis. I recommend trying emojis this way. You can actually impact organic traffic quite interestingly.

  5. Ivan Culic says

    Removing emojis served by WordPress is a sound decision performance wise. However, if you want to get rid of all emojis due to design inconsistencies, using the plugin discussed or extending your functions-file is just part of the equation. People will still be able to use Emoji characters. Whether these are displayed properly depends on native support. The only solution is to use a regular expression matching the Unicode emoji list and then replace them with your own for a unified look (isn’t WordPress trying to do that?) or remove them from the string altogether. Emojis have changed the way we communicate, love them ❤️ or hate them

  6. mayasl says

    I would say find some codes to remove the emoji, rather than installing another plugin which is another load.

  7. Harshadewa says

    Not sure if Mark missed few parts in that code. This code worked for me (there are two additional lines). You should add it to your ”theme” functions.php

    // REMOVE WP EMOJI
    remove_action(’wp_head’, ’print_emoji_detection_script’, 7);
    remove_action(’wp_print_styles’, ’print_emoji_styles’);

    remove_action( ’admin_print_scripts’, ’print_emoji_detection_script’ );
    remove_action( ’admin_print_styles’, ’print_emoji_styles’ );

    Thanks

  8. Serge says

    I Have customers complaining about emoji icons showing instead of navigation buttons. It happens when they view pictures using a light-box.

  9. Therese says

    I was experiencing slow admin panel loading times with 4.2 update. Installed this and it went away! Yay! How frustrating!

  10. Mikael Andersen says

    Thank you

    I have not even thought that it could slow down websites in WordPress.

    A question to the above discussion. Does the plugin just contain the code suggested from Mark, and nothing else.

  11. Joel Libava says

    Thanks for that info…I have to tell you though, the biggest issue with latest wp is the anchor text link editor. What did the developers do? And, why?

    The Franchise King®

    • WPBeginner Support says

      We agree that it was a surprising change that has had many publishers worried. There are plugins in work to resolve this issue. However, core is not going to go back to link title.

      Administratör

  12. Mark says

    Isn’t it best to disable it by adding the following to functions.php rather than having yet another plugin:

    remove_action( ’wp_head’, ’print_emoji_detection_script’, 7 );
    remove_action( ’wp_print_styles’, ’print_emoji_styles’ );

  13. Chad Williams says

    So to disable emojis you suggest installing a plugin that adds back an additional file to do so? I’m sure there’s a better way to do this via functions.php.

Lämna ett svar

Tack för att du väljer att lämna en kommentar. Tänk på att alla kommentarer modereras enligt våra policy för kommentarer, och din e-postadress kommer INTE att publiceras. Vänligen använd INTE nyckelord i namnfältet. Låt oss ha en personlig och meningsfull konversation.