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

Written by Dan Mossop

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.

We may earn a commission when you visit links on our website.

Solve Divi Booster Errors Effortlessly

Eliminate errors like "Using $this when not in object context" by ensuring your plugin files are up-to-date. Avoid unpredictable behavior with Divi Booster by correctly removing old versions.

Latest Posts

Add a Visible Shadow to Divi Gallery Lightbox Arrows

Give the lightbox navigation arrows in your Divi galleries a stylish pop and improve their visibility by adding a shadow beneath the arrows. This quick guide will show you how to make your navigation arrows stand out against the lightbox overlay.Add a Visible Shadow...

Adjust Lightbox Arrow Size in Divi Gallery

Customize the size of the navigation arrows that appear in your gallery lightbox so they’re easier to see and aligned with your site’s design. Whether you want larger, more accessible controls or a subtler look, setting a precise arrow size creates a more polished...

Change Lightbox Arrow Color in the Divi Gallery Module

Make the lightbox navigation arrows in your Divi Gallery match your brand and stand out against your images by assigning a custom color. This improves visual consistency, enhances accessibility with better contrast, and elevates the overall browsing experience for...

Change the Divi Gallery Module Grid Image Scaling

Divi’s Gallery module offers a great way to showcase images, but it can sometimes stretch or crop them in unwanted ways. This article explains how to manage the module’s image scaling behavior to ensure your images are displayed at the correct size and aspect...

About Dan Mossop

Dan is a Scottish-born web developer, now living in Brisbane with his wife and son. He has been sharing tips and helping users with Divi since 2014. He created Divi Booster, the first Divi plugin, and continues to develop it along with 20+ other Divi plugins. Dan has a PhD in Computer Science, a background in web security and likes a lot of stuff, 

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