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.

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.

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

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

Latest Posts

Set Custom CSS IDs for Individual Divi Accordion Items

Assigning unique CSS IDs to specific Divi Accordion items allows for precise control over styling, targeting, and linking within your page content. This ability is particularly useful when you want to apply custom designs or create anchor links to particular accordion...

Enable Swipe Navigation in the Divi Gallery Lightbox

Enabling swipe navigation in the Divi Gallery module's lightbox allows users to seamlessly browse through gallery images by swiping left or right, creating a more interactive and mobile-friendly experience. This functionality can significantly improve user engagement...

Disable Slide-In Animation for Divi Gallery Grid Images

Control how images appear in your Divi Gallery module by toggling the slide-in animation effect for grid layouts. Disabling the slide-in animation allows gallery images to load instantly and appear statically, providing a faster and distraction-free browsing...

Control Image Count Display in Divi Gallery Lightbox

Displaying or hiding the image count in the Divi Gallery module’s lightbox can help customize the user experience, depending on whether you want to give visitors an indication of gallery progress or prefer a cleaner, distraction-free view. The ability to toggle this...

Hide Gallery Image Titles in the Divi Lightbox Overlay

Displaying image titles in the lightbox overlay of the Divi Gallery module can sometimes be distracting or unnecessary, depending on your website’s design and user experience goals. Hiding these titles creates a cleaner and more focused viewing experience for visitors...

Random Posts