2
votes

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."

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?

3

3 Answers

8
votes

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
votes

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);
0
votes

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.