Divi Booster Error: Using $this when not in object context

If you receive an error similar to the following after updating Divi Booster:

PHP Fatal error: Using $this when not in object context in
/yoursite/htdocs/wp-content/plugins/divi-booster/fixes/064-set-body-font-size/settings-general.php

The problem is not actually with Divi Booster, or with Divi Theme updates. Instead its likely to be a result of old versions of the plugin not being correctly removed from your server.

The Problem

Some services (such as WP Engine) let you set up your site in a "staging" environment and, when you are happy, push the results to the "live" site. Unfortunately such services may be configured to copy changed files and new files to the live site, but not to delete old files. The result is that when you update plugins on the staging site and then copy them to the live site, files which were in an old version of a plugin, but have been removed in newer versions, may still exist on the "live" site, instead of being removed as they should. This mix of old and new plugin files can cause unpredictable behavior and should be avoided.

It is this process that is causing the error above, as the file in question has been removed from Divi Booster and should not be left in the plugin folder.

Please note that this method of copying files from the staging server to a live server without removing deleted files is a general issue which may also affect other plugins. Furthermore, it can pose a security risk as old, potentially vulnerable, files may remain on your live server even after plugin security updates have been applied on the staging server and synced to the live site.

Solving the Problem

Long-term: To solve this problem, it is necessary to remove the old plugin files from the live server when updating plugins. How this is done will depend on the service or setup in question. If you are unsure how to achieve this, it may be necessary to contact your hosting server to request guidance on how to delete old files from the live server when pushing changes from the staging server to the live server.

Short-term: In the short term you may be able to be able to manually work around it by deleting the Divi Booster plugin folder (at /path-to-your-site/wp-content/plugins/divi-booster/) from the live server and then republishing the staging site to the live server.

This post may contain referral links which may earn a commission for this site

Divi Booster

Hundreds of new features for Divi
in one easy-to-use plugin

0 Comments

Submit a Comment

Comments are manually moderated and approved at the time they are answered. A preview is shown while pending but may disappear if your are cookies cleared - don't worry though, the comment is still in the queue.

Your email address will not be published. Required fields are marked *.