bainternet / Tax-Meta-Class

A class for creating WordPress taxonomies custom fields
http://en.bainternet.info/2012/wordpress-taxonomies-extra-fields-the-easy-way
GNU General Public License v3.0
406 stars 111 forks source link

Warning: Illegal string offset 'url' in ...... 1443 php 7.1 #135

Open ghost opened 7 years ago

ghost commented 7 years ago

Warning: Illegal string offset 'url' in D:\xampp\htdocs\projects\edu-medic\wp-content\themes\edu\Tax-meta-class\Tax-meta-class.php on line 709

Warning: Cannot assign an empty string to a string offset in D:\xampp\htdocs\projects\edu-medic\wp-content\themes\edu\Tax-meta-class\Tax-meta-class.php on line 709

Warning: Illegal string offset 'id' in D:\xampp\htdocs\projects\edu-medic\wp-content\themes\edu\Tax-meta-class\Tax-meta-class.php on line 711

Warning: Cannot assign an empty string to a string offset in D:\xampp\htdocs\projects\edu-medic\wp-content\themes\edu\Tax-meta-class\Tax-meta-class.php on line 711

Warning: Illegal string offset 'url' in D:\xampp\htdocs\projects\edu-medic\wp-content\themes\edu\Tax-meta-class\Tax-meta-class.php on line 712

Warning: Illegal string offset 'url' in D:\xampp\htdocs\projects\edu-medic\wp-content\themes\edu\Tax-meta-class\Tax-meta-class.php on line 712

Warning: Cannot assign an empty string to a string offset in D:\xampp\htdocs\projects\edu-medic\wp-content\themes\edu\Tax-meta-class\Tax-meta-class.php on line 712

Warning: Illegal string offset 'url' in D:\xampp\htdocs\projects\edu-medic\wp-content\themes\edu\Tax-meta-class\Tax-meta-class.php on line 721

Warning: Illegal string offset 'id' in D:\xampp\htdocs\projects\edu-medic\wp-content\themes\edu\Tax-meta-class\Tax-meta-class.php on line 722

Warning: Illegal string offset 'url' in D:\xampp\htdocs\projects\edu-medic\wp-content\themes\edu\Tax-meta-class\Tax-meta-class.php on line 723

mehrshaddarzi commented 7 years ago

i have this problem. please change tax_meta_class.php in line 704-706 to

$std = array('id' => '', 'url' => ''); if(is_array($field) and isset($field['std'])) { unset($std); $std = $field['std']; } $name = esc_attr( $field['id'] ); if(!isset($_GET['tag_ID'])) { $value = array('id' => '', 'url' => ''); } else { if(is_array($field) and isset($meta['id'])) { unset($value); $value = $meta; } }

IdolR commented 7 years ago

Fantastic @mehrshaddarzi this helped me! Thanks!

niamrox commented 7 years ago

Solution works fine when creating new Taxonomy but not working in Edit mood. Image or Media upload button have no respond. Thanks

IdolR commented 7 years ago

The solution works for me, always. I see that @Biswash-Developer is using a Thimpress theme as me! I wonder if this code is still supported since get_term_meta was introduced, maybe @bainternet can comment?

bainternet commented 7 years ago

@RixNox The Code uses "get_term_meta".

As for anyone with this issue, please paste here to code you used to register the field for me to have a look.

danielbarenkamp commented 6 years ago

Better is to change line 704 from this: $std = isset($field['std'])? $field['std'] : array('id' => '', 'url' => ''); to this: $std = (isset($field['std']) && !empty($field['std'])) ? $field['std'] : array('id' => '', 'url' => '');

IdolR commented 6 years ago

@db-dzine (Daniel) could you explain your changes?

danielbarenkamp commented 6 years ago

@RixNox If you set an empty string to $std then the old function does not check this. Thats what i fixed.

IdolR commented 6 years ago

Thanks. I have applied changes to code following @mehrshaddarzi suggestions. Should I apply your changes to his code or to the original code?

danielbarenkamp commented 6 years ago

Replace original