Can’t upgrade WordPress or add new plugin while logged in as admin (using Sage theme)

I am logged into a WordPress site backend as an administrator. The theme was built using the Sage Starter Theme.

During development there was no issue with adding plugins or upgrading the core, but since moving to production, there is no “Add New” button for plugins and the upgrade message reads “WordPress 4.3 is available! Please notify the site administrator.”

Read More

I tried manually changing the db_version field of the wp_options table to force a database upgrade. This didn’t work.

I tried disabling all plugins and changing to the twentyten theme – this did not work.

Checked all permissions on the server – no joy.

How can I resolve this issue?

Related posts

4 comments

  1. The latest Sage Starter theme uses a .env file to set up environments via the phpdotenv library. It lives in a directory above the public HTML web root of the WordPress installation.

    If you changed the line WP_ENV=development to WP_ENV=production in the .env file when the site went live, then it’s likely this is the source of the issue.

    If you look at the actual configuration for the production environment in /config/environments/production.php, you see the following:

    define('DISALLOW_FILE_MODS', true); // this disables all file modifications including updates and update notifications
    

    This tells WordPress not to allow manual addition of plugins or allow core updates. You can simply edit this to be:

    define('DISALLOW_FILE_MODS', false); // allow file modifications including updates and update notifications
    

    After you’ve modified the core or added plugins, you can simply change it back if you don’t want admins to have this power, but a better solution would be to install a capability manager plugin and define an admin role with slightly lower privileges.

  2. For anyone else with this problem, there is another line that you may have to find in your wp-config or functions file and change to false:

    define('DISALLOW_FILE_EDIT', true);
    
  3. I can’t find the line define('DISALLOW_FILE_MODS', true); or define('DISALLOW_FILE_MODS', false); in my wp-config.php file.

    My solution: I just added the line define('DISALLOW_FILE_MODS', false); in wp-config.php file after define('DB_HOST', 'localhost'); /* or anywhere */

    That SOLVED my problem and I was able to update again core, theme and plugins.

  4. In my case, the problem was caused by the removed permissions for my “administrators” user group.

    More exactly the update_core were missing in wp_options table option_name = %wp-table-prefix%_wp_user_roles

    The easiest way to fix it is to install PublishPress Capabilities plugin and you can find it in the “Admin” tab. First, click black X (negate all) and save and then you can enable it.

    The same maybe for plugins and themes updates.

Comments are closed.