Errors with debug logging turned on

Support General Errors with debug logging turned onResolved

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #15300
    Peter HannamPeter Hannam
    Participant

    With 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

    #15306
    Anh TranAnh Tran
    Keymaster

    Hi 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 the rwmb_meta_boxes filter.
    • Forget to add fields to the meta boxes.
    #15309
    Peter HannamPeter Hannam
    Participant

    Hi,

    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,
    Pete

    #15316
    Peter HannamPeter Hannam
    Participant

    All 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.

    #15319
    Anh TranAnh Tran
    Keymaster

    Hi 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.

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.