bainternet / My-Meta-Box

A class for creating custom meta boxes for WordPress
http://en.bainternet.info/2012/how-i-add-a-wordpress-metabox
GNU General Public License v3.0
224 stars 89 forks source link

PHP Errors #107

Open iolson opened 10 years ago

iolson commented 10 years ago

Has anyone else had these issues (class has only had one line added/altered, and this was to enqueue our custom jQuery for admin page), and figured out how to resolve these issues?

Added on Line 166: wp_enqueue_script( 'meta-box-custom-js', $plugin_path . '/js/custom-scripts.js', array( 'jquery' ), null, true );

Error 1

PHP Warning: Illegal string offset 'type' in /meta-box-class/my-meta-box-class.php on line 1186

Line 1186: $temp[] = $repeater_field['type'];

Error 2

PHP Warning: call_user_func() expects parameter 1 to be a valid callback, class 'AT_Meta_Box' does not have a method 'show_field_' in /meta-box-class/my-meta-box-class.php on line 451

Line 451: call_user_func ( array( $this, 'show_field_' . $f['type'] ), $f, '');

Error 3

PHP Warning: Illegal string offset 'id' in /meta-box-class/my-meta-box-class.php on line 445 PHP Warning: Illegal string offset 'id' in /meta-box-class/my-meta-box-class.php on line 446

Line 445: $id = $field['id'].'[CurrentCounter]['.$f['id'].']'; Line 446: $f['id'] = $id;

Error 4

PHP Warning: Illegal string offset 'type' in /meta-box-class/my-meta-box-class.php on line 450 PHP Warning: Illegal string offset 'type' in /meta-box-class/my-meta-box-class.php on line 451 PHP Warning: call_user_func() expects parameter 1 to be a valid callback, class 'AT_Meta_Box' does not have a method 'show_field_c' in /meta-box-class/my-meta-box-class.php on line 451

Line 450: if ($f['type'] != 'wysiwyg') Line 451: call_user_func ( array( $this, 'show_field_' . $f['type'] ), $f, '');

bainternet commented 10 years ago

Create a fork and post me the link, I'll give it a look.

sn00pee commented 9 years ago

ive also been getting similar errors:

Warning: Illegal string offset 'type' in /home/sites/heteml/users42/h/i/r/hiroin/web/hiroin/test/wp-content/themes/hiroin/meta-box-class/my-meta-box-class.php on line 1156

Warning: Illegal string offset 'type' in /home/sites/heteml/users42/h/i/r/hiroin/web/hiroin/test/wp-content/themes/hiroin/meta-box-class/my-meta-box-class.php on line 1158

Warning: array_merge(): Argument #2 is not an array in /home/sites/heteml/users42/h/i/r/hiroin/web/hiroin/test/wp-content/themes/hiroin/meta-box-class/my-meta-box-class.php on line 1160

The weird thing is that I've tested it on my server (US based), which works, and my client's server (JP based), where it doesnt work.