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.
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.
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.
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.
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.
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.
Slutligen togglar du omkopplaren från ”Activate” till ”Inaktiverad” och klickar på knappen ”Save 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.
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.
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!
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
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.
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.
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.
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
WPBeginner Support says
Thank you for letting us know about the plugin, for the code you can manually add it to avoid that message using FTP. We cover how to use FTP in our article below:
https://www.wpbeginner.com/beginners-guide/how-to-use-ftp-to-upload-files-to-wordpress-for-beginners/
Administratör
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.
WPBeginner Support says
Thank you for letting us know about the plugin being closed
Administratör
Roshni says
The auto update plugin is closed for download since Oct 2018. Any substitute?
Thanks
Roshni
WPBeginner Support says
Hi Roshni,
Please see our tutorial on managing automatic wordpress updates.
Administratör
Roshni says
Thank you. That is useful.
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.
WPBeginner Support says
Hi,
You can install WP Rollback plugin. Rollback a few of your plugins to older versions and then test automatic updates.
Administratör
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!
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.
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
WPBeginner Support says
Hi Anja,
You can add the code at the end of your functions.php file.
Administratör
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.
WPBeginner Support says
Hi Anja,
We are unsure why the code wouldn’t work for you. Make sure that you are adding it to functions.php file. As an alternate you may want to try Easy Updates Manager plugin which allows you to set automatic updates via admin area.
Devin says
If you edit the functions.php file ….. won’t it just get overwritten by any new wordpress framework updates?
WPBeginner Support says
Hey Devin,
In many cases if you are using a framework, then you are probably also using a child theme. In that case you can add code to child theme’s functions file. Alternatively, you can add your code in a site-specific plugin.
Administratör
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
WPBeginner Support says
Hi Steve,
Yes, we still recommend it.
Administratör
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.
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.
WPBeginner Support says
Hi Oosman,
You need to make changes to functions.php file in your currently active theme’s folder.
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.
WPBeginner Support says
Glad you find it helpful.
Administratör
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!
WPBeginner Support says
No, and thanks for notifying us. We have fixed the code snippet.
Administratör
Shelley Provenza says
Should the 2nd snippet for themes be this?:
add_filter( ’auto_update_theme’, ’__return_true’ );