Errors with debug logging turned on
- This topic has 4 replies, 2 voices, and was last updated 5 years, 10 months ago by
Anh Tran.
-
AuthorPosts
-
July 9, 2019 at 8:17 PM #15300
Peter Hannam
ParticipantWith debug logging enabled every page is reporting these errors:
Notice: Undefined index: fields in /nas/content/live/devmyswitchboa/wp-content/plugins/meta-box/inc/meta-box.php on line 67
Warning: Invalid argument supplied for foreach() in /nas/content/live/devmyswitchboa/wp-content/plugins/meta-box/inc/meta-box.php on line 383
Warning: Invalid argument supplied for foreach() in /nas/content/live/devmyswitchboa/wp-content/plugins/meta-box-aio/vendor/meta-box/meta-box-columns/class-mb-columns-processor.php on line 106
Warning: Invalid argument supplied for foreach() in /nas/content/live/devmyswitchboa/wp-content/plugins/meta-box/inc/meta-box.php on line 112
Warning: Invalid argument supplied for foreach() in /nas/content/live/devmyswitchboa/wp-content/plugins/meta-box/inc/meta-box.php on line 84
Notice: Undefined index: fields in /nas/content/live/devmyswitchboa/wp-content/plugins/meta-box/inc/meta-box.php on line 67
Warning: Invalid argument supplied for foreach() in /nas/content/live/devmyswitchboa/wp-content/plugins/meta-box/inc/meta-box.php on line 383
Warning: Invalid argument supplied for foreach() in /nas/content/live/devmyswitchboa/wp-content/plugins/meta-box-aio/vendor/meta-box/meta-box-columns/class-mb-columns-processor.php on line 106
Warning: Invalid argument supplied for foreach() in /nas/content/live/devmyswitchboa/wp-content/plugins/meta-box/inc/meta-box.php on line 112
Warning: Invalid argument supplied for foreach() in /nas/content/live/devmyswitchboa/wp-content/plugins/meta-box/inc/meta-box.php on line 84
July 10, 2019 at 9:05 AM #15306Anh Tran
KeymasterHi Peter,
These errors happen because some meta box is mis-configured. Please check the code for meta box registration to make sure it follows the docs. These are usual problems:
- Forget to return the
$meta_boxes
variable from the callback for therwmb_meta_boxes
filter. - Forget to add fields to the meta boxes.
July 10, 2019 at 1:51 PM #15309Peter Hannam
ParticipantHi,
For point 1, I was following your example here - and it would presumably not be possible to return the
$meta_boxes
variable as we've called die/exit.And I'm sorry but I don't understand your second point - I copied and pasted the output from the builder into my functions.php and then deleted the fieldset from the builder. How could I be missing fields? I'll delete everything and slowly reintroduce things to see if I can narrow the problem down.
Thanks,
PeteJuly 10, 2019 at 7:20 PM #15316Peter Hannam
ParticipantAll of the above errors occurred because there was an element missing from the properties array:
'fields' => array()
:$meta_boxes[] = array ( 'title' => 'Log Book', 'id' => 'log-book', 'post_types' => array( 0 => 'log_book', ), 'context' => 'normal', 'priority' => 'high', 'fields' => array() );
I had an empty meta-box configured, as I wanted to use the front-end form for this type but only for the default WordPress editor/title.
July 11, 2019 at 9:00 AM #15319Anh Tran
KeymasterHi Peter,
Glad that you found the problem. That's what I said in the previous comment. However, I've added a simple check for the Meta Box plugin that allows you to have a meta box with no fields. Try it here.
- Forget to return the
-
AuthorPosts
- You must be logged in to reply to this topic.