How to fix the "Fatal error: Uncaught Error: [] operator not supported for strings" error?

And again an error that can occur in combination with a PHP conversion. This does not occur explicitly only with WordPress, also Joomla and Drupal are affected. Generally a missing initialization of an array is the origin of this error.

Solution: Below are several variants and their solutions.

$data[] = '<script type="text/javascript">' . NL;

change to

$data = [];
$data[] = '<script type="text/javascript">' . NL;

Alternatively also

$data = array();
$data[] = '<script type="text/javascript">' . NL;

Missing the definition for

$section_style         = '';

this must be changed to

$section_style         = [];

If the error occurs in this combination

self::$arrMetaBoxes[] = $box;

the variable must also be defined here

self::$arrMetaBoxes = [];
self::$arrMetaBoxes[] = $box;
Without cookies
This website does not use cookies or tracking. More information can be found in the privacy policy.