WordPress.org

Ready to get started?Download WordPress

Forums

How to get WP, plugins and themes to Auto Update (17 posts)

  1. hansenberg
    Member
    Posted 4 months ago #

    Hi. I have a problem with my WP installations auto update function. I have just got the site from someone else and it would not update. I manually updated it twice so it is up to date now, but it still won't auto update plugins and themes, or wordpress for that matter. Is it a hosting problem or is there something I can do to correct the problem?

  2. shadez
    Member
    Posted 4 months ago #

    for starters, check if your wp-config file has:
    DISALLOW_FILE_MODS enabled
    WP_AUTO_UPDATE_CORE disabled
    FS_CHMOD_DIR or FS_CHMOD_FILE set
    and other upgrade constants set such as FTP_HOST/SSL set

    check your files and folders for filepermissions, etc..

  3. hansenberg
    Member
    Posted 4 months ago #

    I have no such constants in my wp-config file. And my file permissions are all 777. Could it be a firewall issue?

  4. shadez
    Member
    Posted 4 months ago #

  5. hansenberg
    Member
    Posted 4 months ago #

    I have tried this option also, but the result is a blank website, until I delete the lines of code again.

  6. davidkonicek
    Member
    Posted 4 months ago #

    Automatic plugin updates are also not working for me. I added the following line to my wp-config file, just like the article said to do.

    add_filter( 'auto_update_plugin', '__return_true' );

    I don't get a blank website like you, though. It simply has no effect for me. I would love to get auto updates working by using the WordPress core, but right now I'm trying the "Updater" plugin. It only allows the auto updates every hour at the least, so I have to wait a bit to see if it will work.

  7. hansenberg
    Member
    Posted 4 months ago #

    @davidkonicek

    Let me know if the plugin works for you.

  8. shadez
    Member
    Posted 4 months ago #

    thats strange.. those filters are not supported for WPMS and for custom Plugins folder (as given in docs). hope you dont have either.

    @David: if you are good with DB then you could probably clear the value or drop the entry for _site_transient_update_plugins from wp_options table. that should ideally check for plugin updates at the next reload.
    pls take backups etc.

  9. davidkonicek
    Member
    Posted 4 months ago #

    Hey guys, I resolved my issue, and hope that it helps you. I was wrong to add a filter to wp-config.php because filters are supposed to be added to a plugin. I also assumed the updates would happen immediately, but WordPress checks every 12 hours. Also, the "Updater" plugin successfully updated my plugins after an hour.

    Final Solution:
    I'm using the "Automatic Plugin Updates" plugin and I'm expecting it will work after waiting 12 hours for WordPress to check for updates.

    I also wanted to automatically update WordPress core files (major and minor, but not dev), so I created a plugin for that. Here's how:
    1. Create a folder on your computer called "automatic-wordpress-updates"
    2. Inside that folder, create a file called "automatic-wordpress-updates.php"
    3. Add this code to the file

    <?php
    /*
    Plugin Name: Automatic WordPress Updates
    Description: Enable major and minor core updates. Disable dev updates.
    */
    add_filter( 'allow_minor_auto_core_updates', '__return_true' );
    add_filter( 'allow_major_auto_core_updates', '__return_true' );
    add_filter( 'allow_dev_auto_core_updates', '__return_false' );
    ?>

    4. Save it and upload the folder to your plugins directory.
    5. Activate the plugin, and you should be all set.

    I'm still waiting to see if all these updates will get made after 12 hours. If you see something wrong with my code, let me know.

  10. shadez
    Member
    Posted 4 months ago #

    Glad to hear that. :)

    made bit of change for automatic-wordpress-updates.php, just in case somebody uses this:

    <?php
    /*
    Plugin Name: Automatic WordPress Updates
    Description: Enable major and minor core updates. Disable dev updates.
    Author: davidkonicek
    */
    
    static function awu_check() {
    	if ( version_compare( $GLOBALS['wp_version'], '3.7', '<' ) ) { deactivate_plugins( self::$basename ); wp_die( 'Update to WP3.7+' ); }
    }
    
    function awu_install() {
    add_filter( 'allow_minor_auto_core_updates', '__return_true' );
    add_filter( 'allow_major_auto_core_updates', '__return_true' );
    add_filter( 'allow_dev_auto_core_updates', '__return_false' );
    
    private $itemarray = array("theme", "plugin", "translation");
    foreach ( $itemarray as $item ) { add_filter( 'auto_update_' . $item, '__return_true', 1 ); }
    // Disable translation if required
    
    // Disable update emails
    add_filter( 'auto_core_update_send_email', '__return_false' );
    
    register_activation_hook ( __FILE__, array( 'awu_check', 'awu_install' );
    ?>

    i havent integrated check for WPMS and plugin_url, etc. lots more to be done. but well thats a start.. :)

    alternatively,
    add add_filter( 'allow_minor_auto_core_updates', '__return_true' ); and similar filters in functions.php file in your theme for it to work.

  11. davidkonicek
    Member
    Posted 4 months ago #

    Very cool! Thanks for letting people know to update that. My expertise is not PHP.

    To anyone who uses this in their theme's functions.php file - make sure your mods don't get overwritten when updating the theme.

  12. davidkonicek
    Member
    Posted 4 months ago #

    When I implemented your changes to the plugin I received this error:

    Parse error: syntax error, unexpected T_FUNCTION, expecting T_PAAMAYIM_NEKUDOTAYIM in /home/examplesite/public_html/wp-content/plugins/automatic-wordpress-updates/automatic-wordpress-updates.php on line 8

    This is beyond me. I wonder if it will work with the original plugin I came up with. Or maybe this is a simple fix.

    Let me know. Thanks.

  13. davidkonicek
    Member
    Posted 4 months ago #

    I'm trying out the "Update Control" plugin now. The only reason I didn't use it before is because I couldn't select specific plugins to update. I'm going to try it in addition to the "Automatic Plugin Updates" plugin.

  14. hansenberg
    Member
    Posted 4 months ago #

    Hi guys.

    Thanks for the help. I will try these plugins, and wait to see if it works.

  15. shadez
    Member
    Posted 4 months ago #

    hey David,
    sorry i didnt run the code before posting.
    check this:

    <?php
    /*
    Plugin Name: Automatic WordPress Updates
    Description: Enable major and minor core updates. Disable dev updates.
    Author: davidkonicek
    */
    function awu_install() {
    if ( version_compare( $GLOBALS['wp_version'], '3.7', '<' ) ) { wp_die( 'Update to WP3.7+' ); }
    add_filter( 'allow_minor_auto_core_updates', '__return_true' );
    add_filter( 'allow_major_auto_core_updates', '__return_true' );
    add_filter( 'allow_dev_auto_core_updates', '__return_false' );
    
    $itemarray = array("theme", "plugin", "translation");
    foreach ( $itemarray as $item ) { add_filter( 'auto_update_' . $item, '__return_true', 1 ); }
    // Disable translation if required
    
    // Disable update emails
    add_filter( 'auto_core_update_send_email', '__return_false' );
    }
    register_activation_hook( __FILE__, 'awu_install' );

    also, always remember to save the files in utf-8 encoding (or whatever is specified in your wp-config.php file). otherwise you will run into some xxxx character encoding warnings and stuff.

  16. Cyanara
    Member
    Posted 4 months ago #

    Have you had any luck, hansenberg? This is a frustrating problem for me too and none of the plugin solutions seem to be doing anything.

    It only happens for two sites I manage on a particular hosting server chosen by a client, and everything else is the same as my working sites, so I'm inclined to believe that it's a hosting issue. However, beyond recreating the database, WP installation, and websites from scratch, and changing the FTP permissions (all of which I did), I'm not sure what else I can do.

    PS: You might want to reconsider having your WP FTP permissions set to 777. That opens you up to complete public access, as I understand it, which basically means your site will inevitably be hacked. There are lots of personal thoughts on what permissions to use, but maybe refer to this summary at Stack Overflow

  17. hansenberg
    Member
    Posted 4 months ago #

    No I just got an new update from WP and my theme plus a plugin and none of theme are able to auto update. I can only do it manually, so I still need a solution to the problem. I think it is a hosting problem to, but there are apparently many who has this problem

Reply

You must log in to post.

About this Topic

Tags