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 aktiverar du automatiska updates för tillägg och themes i WordPress

Senast frågade en av våra läsare hur man automatiskt kan updating WordPress tillägg.

Många användare tycker att det är irriterande att de nästan varannan dag måste uppdatera ett plugin.

I den här artikeln visar vi dig hur du aktiverar automatiska updates för tillägg till WordPress. Vi visar dig också hur du utesluter vissa tillägg från automatiska updates.

How to Enable Automatic Updates for WordPress Plugins

När och varför bör du automatiskt updating WordPress tillägg?

Som standard kan WordPress automatiskt update sig själv när en säkerhets- eller mindre release är available. För större releaser måste du själv initiera updating. Du måste också installera tillägg och theme updates själv.

Att hålla din WordPress-webbplats updating är avgörande för säkerheten och stabiliteten på din site. Se vår guide om varför du alltid bör använda den senaste versionen av WordPress för mer detaljer.

Detsamma gäller för alla tillägg och teman som är installerade på din website. Du måste installera updates för plugins och themes för att få nya funktioner och fixar.

Men you may have notice that some of them are updated more frequently than others. Många populära tillägg till WordPress uppdateras nästan varje vecka.

WordPress updates

Vissa användare tycker att det är lite distraherande att det varje gång de loggar in finns en update tillgänglig för ett eller flera tillägg.

Tänk om du kunde allow trusted utvecklare to auto-update plugins similar to WordPress?

Låt oss ta en titt på hur du automatiskt kan updating tillägg i WordPress.

Så här installerar du automatiskt updates för vissa tillägg i WordPress

WordPress introducerade automatiska updates för WordPress tillägg och teman i WordPress 5.5. Detta allow dig att aktivera automatiska updates för enskilda WordPress tillägg och themes direkt från din WordPress dashboard.

Aktivera auto-updates för enskilda tillägg

Besök bara Plugins ” Installed Plugins page inne i WordPress admin area. Här ser du listan över alla dina installerade plugins med en länk till ”Aktivera auto-updates” bredvid varje plugin.

Enable automatic updates for WordPress plugins

You need to click on the ”Enable auto-updates” link to turn on automatic updates for individual plugins.

Aktivera auto-updates för WordPress Themes

För teman i WordPress går du till Appearance ” Themes och klickar på det theme som du vill uppdatera automatiskt.

Detta kommer att visa popup-fönstret med information om temat. Härifrån kan du klicka på länken ”Enable auto-updates” för att aktivera automatiska uppdateringar för det temat.

Theme auto-updates

Det var allt. WordPress kommer nu automatiskt att uppdatera dessa tillägg och themes när en new version är available. Du kommer också att få ett email notification när en new update installeras på din website.

Setting up Automatic Update for All WordPress Tillägg

Du kan ställa in WordPress att automatiskt installera alla plugin-uppdateringar genom att helt enkelt lägga till den här koden i ditt temas functions.php-fil, ett site-specifikt plugin eller ett code snippets plugin.

add_filter( 'auto_update_plugin', '__return_true' );

Detta filter säger till WordPress automatiska updating att automatiskt installera tilläggsuppdateringar när de är tillgängliga.

Om du också vill uppdatera dina themes automatiskt, kan du add to en annan kod som gillar detta:

add_filter( 'auto_update_theme', '__return_true' );

Vi rekommenderar att du lägger till den här koden med hjälp av pluginet WPCode. Det är det säkraste och enklaste sättet att add to custom code snippets i WordPress utan att editera ditt temas functions.php-fil.

För att komma igång måste du installera och aktivera det gratis pluginet WPCode. Om du behöver instruktioner kan du läsa den här guiden om hur du installerar ett plugin för WordPress.

När pluginet är aktiverat går du till Code Sn ippets Add Sn ippet från din WordPress dashboard. Därifrån hittar du alternativet ”Add Your Custom Code (New Snippet)” och klickar på knappen ”Use snippet” under den.

Add a new custom code snippet in WPCode

Lägg sedan till en rubrik för ditt code snippet. Det kan vara vad som helst som hjälper dig att komma ihåg vad koden är till för.

Sedan klistrar du bara in koden ovan i boxen ”Code Preview” och väljer ”PHP Snippet” som code type från dropdown-menyn.

Paste code snippet into WPCode

Slutligen togglar du omkopplaren från ”Activate” till ”Inaktiverad” och klickar på knappen ”Save Snippet”.

Activate and save your custom code snippet

Nu är det klart. Om du vill add to den andra koden ovan upprepar du bara dessa steg.

Hur rullar jag tillbaka till en tidigare version av tillägget efter Update?

Tillägg eller teman som inte är kompatibla kan orsaka problem på din website. Även om de flesta bra utvecklare testar sina tillägg noggrant, finns det alltid sällsynta buggar som kan orsaka att din site går sönder.

Det första steget du bör ta för att skydda din website är att installera en lösning för backup av WordPress.

Men att återställa din WordPress site från en backup gillar jag, det är mycket jobb. Om du vet vilket plugin eller vilken theme update som orsakade problemet, skulle det vara enklare att bara återställa updatingen.

Så här kan du enkelt rulla tillbaka tillägg till plugin eller updates av teman. Installera och aktivera WP Rollback plugin.

När du har aktiverat går du tillbaka till sidan med tillägg på din site i WordPress. You will notice a new ’Rollback’ alternative under each plugin installed on your site.

Rollback plugin's to previous versions

Click on Rollback will allow you to rollback your plugin to any previous version you want. Det kan också återställa updates av teman. För mer detaljerade instruktioner, se vår guide om hur du återställer tillägg till WordPress.

Vi hoppas att den här artikeln hjälpte dig att konfigurera automatiska updates för tillägg i WordPress. Du kanske också vill se vår guide om hur du aktiverar automatiska uppdateringar i WordPress för större utgå vor eller våra val av de bästa drag and drop page builders för WordPress.

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

42 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. Dennis Muthomi says

    I appreciate your perspective you provided on automatic updates. However, I still prefer to manage plugin and theme updates manually.
    In my experience, automatic updates can sometimes cause compatibility issues that are tricky to identify and troubleshoot when multiple plugins update simultaneously.
    By manually updating plugins one-by-one, I have better control over my site. If an update does cause problems, I know exactly which plugin to rollback :)

  3. Mrteesurez says

    When it’s good to have both plugins and theme with the WordPress core to update automatically, it certainly comes with some cons.
    1) If there is a crash, it will be difficult to easily identify the culprit plugin, theme or specific action that triggered the issue.
    2) For me, I used to firstly check the changealog to know the new features coming with the new update, so I can know what functions has added or removed form the plugin.

    I still choose to do it manually.

  4. Moinuddin Waheed says

    I prefer doing manual updates to my wordpress websites as it gives a sense of control over the update and also it feels secure not to take risk of crashing the website completely.
    I have heard many times that having updated version is of utmost importance to keep the WordPress safe, is it really the security patch that gets updated always or other factors as well?
    Also, is it advisable to always have the latest version or to have update only when there is security update is concerned?

    • WPBeginner Support says

      More than just security is patched when updating a plugin and we recommend keeping plugins and themes up to date as some add helpful new features for your site :)

      Administratör

    • Jiří Vaněk says

      Plugin updates are either due to discovered security issues or new features added by the developer. Updates are also released because WordPress itself is being updated and evolving, along with its functions and code. As a result, the developer often needs to modify the plugin to ensure it remains compatible with the new version of WordPress. Additionally, a plugin might have a new version because the developer updated it to a new version of PHP, for example. There are many reasons, and it’s a good practice to always keep WordPress, plugins, and themes up-to-date.

  5. Jiří Vaněk says

    And what is your specific opinion on automatic updates? Personally, I’ve always found it much better to manage updates manually because it’s possible, and it has often happened to me, that after an update, the website crashed and it took hours or even days before anyone noticed. For that reason, for example, I’ve refrained from automatic updates.

    • WPBeginner Support says

      It depends on the specific site, for more complex sites it is normally better to manually update the site but for simple sites automatic updates are normally for the best.

      Administratör

      • Jiří Vaněk says

        Yes, probably. Personally, I see the benefits of automatic updates mainly in that people who forget about their website still have it up-to-date (until it’s broken by a bad update). You are probably right that for simple websites it makes sense. However, even for medium-sized websites, I would be cautious. Thank you for your opinion.

  6. Madhav Anand says

    Nothing worked out please help.

    1. The plugin which is mentioned no longer available to download and use.
    2. On adding code to functions.php it shows ”Unable to communicate back with site to check for fatal errors, so the PHP change was reverted. You will need to upload your PHP file change by some other means, such as by using SFTP.”

    Please update

  7. Sushil Kumar says

    You can replace the link for ”Automatic Plugin Updates” plugin because it is obsolete now and This plugin was closed on October 2, 2018 and is no longer available for download.

  8. VBWyrde says

    Thanks for this information. I installed the plugins mentioned on my test wordpress site (I want to check out how well it works before applying it to my production site). After Activating the plugin and checking off the one’s I want included in the auto-update… wondering… is there any indicator that the plugins are actually being updated? Or do we just wait and check the site later? Thanks again for your advice on this. Much obliged.

  9. Ahad Arzi says

    Hi, first of all thanks for the post. But, Adding that above mentioned auto update plugin code and theme code is recommended? Or It can create any problems in future?

    Please let me know!

  10. Anja says

    As a follow up, I’ve since installed the recommended plugin and that didn’t work either. Troubleshooting points to the site being a managed GoDaddy account as the culprit, so if anyone else has the same problem that may be the cause.

  11. Anja says

    Hi,

    As a beginner I was wondering where exactly I should put this code? Both examples use line 1, but I’m using a child theme and it needs to enque styles first.

    I’ve put it at the bottom following the CSS rule, but I’m not sure if that would create problems or not? I would really appreciate a response.

    Thanks :)

      • Anja says

        Hi,

        This doesn’t seem to have worked as I’m getting a plug-in that needs to be updated. Being a beginner and not knowing PHP I maybe haven’t nested it properly (I haven’t added any nesting at all)?

        My script reads:

        }
        add_action( ’wp_enqueue_scripts’, ’my_theme_enqueue_styles’ );

        add_filter( ’auto_update_plugin’, ’__return_true’ );

        add_filter( ’auto_update_theme’, ’__return_true’ );

        And it literally ends there. I read on the wordpress codex that lines like this should be added to the wp-config file (which I haven’t done because I have no idea to do it). For educational purposes, why have you chosen functions.php instead?

        Thanks again for your help, and I’m sorry if this is an obvious question.

        • Anja says

          Please? I really don’t know what I’ve done wrong, even though further reading did reveal why you’ve added this to functions.php and NOT the codex (as they write not to put it in for these especially).

        • Anja says

          Pretty please? As a beginner I really can’t think of what else to do, and this article is targeted at beginners. You need to consider that for every one person who takes the time to say something or ask a question there’s probably about 10 others who’ve just passed on.

  12. Devin says

    If you edit the functions.php file ….. won’t it just get overwritten by any new wordpress framework updates?

  13. Steve says

    The WP Rollback plugin has not been updated in 8 months as of 5/16/2017. Do you still recommend it or attest to it’s viability for release 4.7.4 of WordPress or earlier?
    Thx
    Steve

  14. Panagiotis says

    WordPress Codex advises to put this code to wp-config.php what are the pros and cons of putting it to functions.php ?

    • Peter says

      No, it says:
      ”Do NOT add add_filter() calls directly in wp-config.php. WordPress isn’t fully loaded and can cause conflicts with other applications such as WP-CLI.”

      • Panagiotis says

        Ah filters filters filters.
        Got confused because in the codex it gives some definitions as well that should be put in wp-config.php, filters should go on functions.php. Thanks Peter.

  15. Gail Palubiak says

    You left out one small item…HOW does a beginner(!) insert this code? A few additional screen shots would have been helpful. Thanks

    • Panagiotis says

      Hello Gail,
      you can insert this code by logging in with your ftp credentials to your site and edit functions.php that is located in the /public_html/ folder.

      • Oosman Beekawoo says

        There are so many functions.php files in the /public_html/ folder. Which one do I choose?

        There’s one of them in wp-includes, some in a few of my plugin folders and one in each of my theme folders.

  16. Carol Parker says

    Just handing out compliments – this is absolutely the most useful newsletter I have ever encountered. Your one-topic specific ’how to’ posts are so well done – easy to understand and solve issues I didn’t know I had! Thank you, thank you, thank you. My blogs are getting more sophisticated by the day as I learn how to accomplish the fine details.

  17. Jason says

    Great article! Thanks for publishing it!!

    Just curious, the code snippets for both plugins and themes state the same thing. Is there supposed to be a difference?

    Thanks again!

  18. Shelley Provenza says

    Should the 2nd snippet for themes be this?:

    add_filter( ’auto_update_theme’, ’__return_true’ );

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.