Select Page

If you’re seeing warnings like this:

php


Deprecated: Creation of dynamic property DLK_Builder_Module_Course_Content::$icon is deprecated..

You’re likely running PHP 8.2+ and using Divi or a custom-built module. PHP 8.2 deprecated dynamic properties, meaning any code that creates new class properties on the fly (without declaring them first) will now trigger warnings.

This guide gives you three practical options — from quick fixes to long-term solutions — tailored for Divi-based WordPress projects.


Option 1: Downgrade to PHP 8.1 (Quickest Fix)

If you’re in a local or development environment, the fastest way to stop the deprecated warnings is:

Downgrade your PHP version to 8.1

PHP 8.1 doesn’t issue deprecation warnings for dynamic properties, so everything works like before.

When to Use:

  • You’re debugging locally or under a tight timeline

  • You don’t want to touch module code right now

 Why It’s Temporary:

PHP 8.2+ offers better performance and is future-proof. Plus, PHP 9.0 will remove dynamic property support completely — so updating your code is eventually unavoidable.


Option 2: Refactor Custom Divi Modules (Best Practice)

If you’re overriding Divi modules or creating custom ones, PHP 8.2 will throw warnings unless you declare all dynamic properties explicitly.

Example Fix:

Before (causes warning in PHP 8.2):

php


class DLK_Builder_Module_Payment_Buttons extends ET_Builder_Module {

public function __construct() {

$this->fb_support = true;

$this->icon = ‘e005’;

parent::__construct();

}

}

After (safe in PHP 8.2+):

php
class DLK_Builder_Module_Payment_Buttons extends ET_Builder_Module {

public $fb_support = true;

public $icon = ‘e005’;public function __construct() {

parent::__construct();

}

}

Not Sure If Your Module Is Running?

Add this to functions.php temporarily:

php
add_action(‘init’, function () {

error_log(‘✅ DLK Custom Module is loaded’);

});

Then check wp-content/debug.log.

If you see this log, it confirms your module is active — but if the deprecation notice still appears, Divi may be loading its core version before your override runs.

In that case, move to Option 3 below.


Option 3: Suppress Warnings Using a mu-plugin (Recommended for Live Use)

If you want to keep PHP 8.2 but silence these harmless warnings, the most reliable method is to use a mu-plugin (must-use plugin).

Step-by-Step

1. Create this folder if it doesn’t exist:

wp-content/mu-plugins/

2. Inside it, create a file:

disable-deprecated-warnings.php

3. Add the following code:

php


error_reporting(E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED);

Because mu-plugins load before everything else, this approach works even when functions.php or wp-config.php fails to suppress the warnings.