Solution – WordPress and PHP 7.2 Error: PHP Warning Use of undefined constant

wordpress-error-undefined-constant
I recently upgraded one of my WordPress website to PHP version 7.2
Everything was working fine, but when I checked error_log file, I found many PHP error messages like:

PHP Warning: Use of undefined constant ‘DISALLOW_FILE_EDIT’ – assumed ‘‘DISALLOW_FILE_EDIT’’ (this will throw an Error in a future version of PHP)

You can get similar error message for other WordPress constants on PHP 7.2 like:

PHP Warning: Use of undefined constant ‘DISABLE_WP_CRON’ – assumed ‘‘DISABLE_WP_CRON’’ (this will throw an Error in a future version of PHP)

Solution

Solution is very simple. In your wordpress declaration code, put true inside quotation.
Example:

1
define( 'DISALLOW_FILE_EDIT', 'true' );
1
define( 'DISABLE_WP_CRON', 'true' );

I hope this article was helpful to you.

Related Posts

Leave a Reply

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