Correcting an Illegal string offset error in Thesis
A client came to me today with an error they were getting when trying to create a new post in their WordPress admin panel. This is what they were seeing:
Warning: Illegal string offset 'type' in wp-content/themes/thesis/lib/admin/options_post.php on line 150
and they could not get around it to edit or write new posts.
After some digging (and some print_r statements) I found the bug and corrected it by changing the offending line 150 from:
`
if (($meta_field['type']['type'] == 'checkbox') && is_array($meta_field['type']['options'])) { `
to:
`
if ((is_array($meta_field['type'])) && ($meta_field['type']['type'] == 'checkbox') && is_array($meta_field['type']['options'])) { ```
The problem occurs because newer versions of PHP correctly give an error when the ['type'] field contains a value instead of an array. Thesis folks: Please incorporate the above fix!