Introduction
I have encountered this PHP error when I was working on a WordPress website which used a pretty old theme.
I did a bit of research and realized that this was a matter of compatibility between PHP versions.
The error was something like this: Fatal error: Uncaught Error: [] operator not supported for strings in /home/...._markup_html.php:33.
How to fix Uncaught Error: [] operator not supported for strings
The fix for the error is pretty simple.
I checked the code where the error came from and found something like this:
$lsContainer[] = '<div id="'.$sliderID.'" class="ls-wp-container" style="'.implode('', $sliderStyleAttr).'">';
My very simple solution was to define that variable as an array first, like this:
$lsContainer = array();
$lsContainer[] = '<div id="'.$sliderID.'" class="ls-wp-container" style="'.implode('', $sliderStyleAttr).'">';
This fixed the problem and got rid of the error!
Conclusion
This error could give you a headache, but if you follow the above simple solution you should be able to solve it. Good Luck!
Comments closed
Please contact me, if you have any questions or suggestions.