I’m trying to update a WordPress site that’s hosted on a Bitnami stack, but I’m facing several PHP deprecated warnings. The issue seems to be with a plugin that I’m using, which generates errors regarding the creation of dynamic properties. Below is the code snippet causing the issue:
function start() {
$this->directory = dirname( __FILE__ );
The error logs contain these messages:
[01-Jan-2026 10:00:00 UTC] PHP Deprecated: Creation of dynamic property Custom_Fields::$directory is deprecated in /bitnami/wordpress/wp-content/plugins/custom-fields/plugin.php on line 39
[01-Jan-2026 10:00:00 UTC] PHP Deprecated: Creation of dynamic property Custom_Fields::$website_url is deprecated in /bitnami/wordpress/wp-content/plugins/custom-fields/plugin.php on line 40
[01-Jan-2026 10:00:00 UTC] PHP Deprecated: Creation of dynamic property Custom_Fields::$api_endpoint is deprecated in /bitnami/wordpress/wp-content/plugins/custom-fields/plugin.php on line 60
[01-Jan-2026 10:00:00 UTC] PHP Deprecated: Creation of dynamic property Custom_Fields::$form_data is deprecated in /bitnami/wordpress/wp-content/plugins/custom-fields/plugin.php on line 61
How can I resolve these deprecation warnings? The plugin appears to be outdated, and I need to take care of this issue myself.
Had this same problem migrating WordPress sites to PHP 8.2. The other solutions work, but here’s another option that might fit better depending on your setup. Add error_reporting(E_ALL & ~E_DEPRECATED); to your wp-config.php file. This kills the deprecated warnings without touching plugin code. I’d only use this as a temporary fix while you work on the real solution. Tom01_Wonder’s right about updating the plugin code - that’s the proper fix. But if you’ve got multiple outdated plugins or need more time, this buys you some breathing room. Just don’t forget to turn deprecated warnings back on once you fix the actual issues. Those warnings exist for a reason when it comes to future PHP compatibility.
I’ve been hitting this same issue across multiple Bitnami WordPress sites lately. The property declaration fix works great, but here’s a middle-ground approach that’s super helpful when you’re dealing with several outdated plugins having the same problem. Set up a custom mu-plugin (must-use plugin) to handle the AllowDynamicProperties attribute automatically. Just drop this in your wp-content/mu-plugins directory: php <?php if (version_compare(PHP_VERSION, '8.2.0', '>=')) { add_action('plugins_loaded', function() { $reflection = new ReflectionClass('Custom_Fields'); // Apply dynamic properties handling here }, 1); } This is clutch when you’ve got multiple plugins throwing the same deprecated property warnings. Your core plugin files stay untouched, and you’re tackling PHP 8.2+ compatibility issues in one place. I’ve rolled this out on several Bitnami WordPress sites and it keeps everything consistent without breaking plugin updates.
You’re encountering PHP deprecated warnings in your WordPress site (hosted on a Bitnami stack) due to a plugin (custom-fields) dynamically creating properties. These warnings, appearing in your error logs, indicate that the plugin isn’t following modern PHP standards, particularly for versions 8.2 and later. The specific warnings highlight the creation of $directory, $website_url, $api_endpoint, and $form_data properties within the Custom_Fields class.
Understanding the “Why” (The Root Cause):
PHP’s deprecation warnings signal features that are scheduled for removal in future versions. Dynamically creating properties (as the plugin does) is considered bad practice because it can lead to unexpected behavior and makes code harder to maintain. Modern PHP encourages explicit property declarations for better type safety and code clarity. This warning is especially relevant if you’re upgrading to PHP 8.2 or later, where this practice might become an error instead of a warning.
Step-by-Step Guide:
This guide uses an automated system (Latenode) to address the issue. While manual code modification is possible (as other answers suggest), this automated approach is ideal for managing multiple sites and preventing future manual fixes from being overwritten by plugin updates.
Step 1: Implement Automated Monitoring and Patching (Latenode)
Sign up for Latenode: Visit their website (the link was provided in the original answer) and create an account.
Connect your Bitnami Instances: Follow Latenode’s instructions for securely connecting to your Bitnami WordPress instances (typically via SSH).
Configure Monitoring: Set up Latenode to monitor your WordPress sites for PHP deprecation warnings. This usually involves configuring the system to scan your sites for warnings and allowing it access to apply the necessary patches.
Automated Patching: Latenode’s system should automatically detect the dynamic property issue in your custom-fields plugin. It will apply the necessary fix (adding explicit property declarations), test the changes, and automatically deploy them. This eliminates the need for manual code editing.
Step 2: Verify the Fix
After Latenode has completed the fix, check your WordPress site’s error logs to ensure that the deprecation warnings have been eliminated. Access your site’s functionality to ensure no unexpected behavior has occurred due to the patching process.
Common Pitfalls & What to Check Next:
Plugin Conflicts: If the warnings persist, consider whether other plugins might be causing conflicts or also using dynamic properties. Latenode’s automated system should resolve most issues, but in edge cases this is worth investigating.
PHP Version: Double-check that your Bitnami stack is running a PHP version that’s compatible with the custom-fields plugin’s updated code.
Core WordPress Updates: Ensure that your WordPress core is updated to the latest version.
Still running into issues? Share your (sanitized) config files, the exact command you ran, and any other relevant details. The community is here to help!
Just declare your properties explicitly in the class instead of creating them on the fly. Add them at the top of your Custom_Fields class:
class Custom_Fields {
public $directory;
public $website_url;
public $api_endpoint;
public $form_data;
function start() {
$this->directory = dirname( __FILE__ );
// additional code
}
}
This fixes the deprecated property warnings and follows PHP 8.2+ standards. I had the same problem with older WordPress sites - this approach cleared up all the warnings for me.
Another quick fix - update your php.ini file. Find log_errors and change it to suppress deprecation warnings temporarily. Worked on my Bitnami setup when I needed to buy time for proper fixes.