Correcting an illegal string offset error in Thesis

thesis-logo

May 13, 2014 / Updated: June 11, 2014 / Lena Shore
Filed under:

Some clients have been reporting an error when trying to update or create a new post with sites using an older Thesis framework. (1.8x) This can happen on servers that have upgraded their php. Newer versions of PHP (correctly) throw an error when the [‘type’] field contains a value instead of an array.

The error is something like this:

Warning: Illegal string offset 'type' in /wp-content/themes/thesis/lib/admin/options_post .php on line 150

The Fix

Option 1: You can upgrade Thesis to the latest 1.8x or you can change the offending code manually.

Option 2: 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'])) {

Archives

Categories