• Cameron

    (@cameron-macintosh)


    I’m using v4.3.3 of the plugin on wp 3.6.

    For some reason, I experienced some odd behaviors when I included this line from the demo.php script:

    $meta_boxes = array();

    in a custom plugin where I was setting up my meta boxes. I had both my plugin and the demo.php script within the theme folder active at the same time.

    When just my plugin was active, I saw a dozen errors coming from RW_Meta_Box::normalize_fields, my guess is that RW_Meta_Box::normalize_fields didn’t like the fact that I was passing an empty array to New(). Removing the seed empty array fixed this.

    When both my plugin and the demo script were active, the demo boxes would display whereas my plugin’s boxes would not. I think I was having interactions because I set up $meta_box in my plugin to be a global variable like the demo script shows. When I switched over from a global to local variable, my plugin’s meta box reappeared. I get why one would use a global variable to pass around config like this, but it doesn’t seem like it’s 100% safe if one decides to configure multiple meta boxes scattered between the theme and plugins.

    I’m not sure I would consider these bugs, per se, but it did give me several hours of frustrated debugging until I figured it out.

    http://ww.wp.xz.cn/plugins/meta-box/

The topic ‘wierdness with $meta_boxes=array();’ is closed to new replies.