Support » Plugin: CMB2 » admin array and header error

  • Resolved EliWbbr

    (@eliwbbr)


    I’m getting two errors in the wp admin that are relating to the cmb2 lib (which i LOVE, by the way). Here are the errors:

    Notice: Array to string conversion in ../themes/patk_nickell/cmb2/includes/CMB2_Hookup.php on line 141

    Warning: Cannot modify header information – headers already sent by (output started at ../themes/patk_nickell/cmb2/includes/CMB2_Hookup.php:141) in ../staging21.thestudio-patrick.com/public_html/wp-includes/functions.php on line 6270

    I think it related to the file field type. Because on the page you can see this code above that file upload field input box:

    Notice: Undefined offset: 1 in ../wp-content/themes/patk_nickell/cmb2/includes/types/CMB2_Type_File_Base.php on line 146

    Notice: A non well formed numeric value encountered in ../wp-includes/media.php on line 445

    Notice: Undefined offset: 1 in ../wp-content/themes/patk_nickell/cmb2/includes/CMB2_Utils.php on line 145

    Notice: A non well formed numeric value encountered in ../wp-content/themes/patk_nickell/cmb2/includes/CMB2_Utils.php on line 152

    Notice: Undefined offset: 1 in ../wp-content/themes/patk_nickell/cmb2/includes/CMB2_Utils.php on line 137

    Notice: A non well formed numeric value encountered in ../public_html/wp-includes/media.php on line 445

    Notice: Undefined offset: 1 in ../wp-content/themes/patk_nickell/cmb2/includes/CMB2_Utils.php on line 145

    Notice: A non well formed numeric value encountered in ../wp-content/themes/patk_nickell/cmb2/includes/CMB2_Utils.php on line 152

    Notice: Undefined offset: 1 in ../wp-content/themes/patk_nickell/cmb2/includes/CMB2_Utils.php on line 137

    Notice: A non well formed numeric value encountered in ../public_html/wp-includes/media.php on line 445

    Notice: Undefined offset: 1 in ../wp-content/themes/patk_nickell/cmb2/includes/CMB2_Utils.php on line 145

    Notice: A non well formed numeric value encountered in ../wp-content/themes/patk_nickell/cmb2/includes/CMB2_Utils.php on line 152

    Notice: Undefined offset: 1 in ../wp-content/themes/patk_nickell/cmb2/includes/CMB2_Utils.php on line 137

    Notice: A non well formed numeric value encountered in ../public_html/wp-includes/media.php on line 445

    Notice: Undefined offset: 1 in ../wp-content/themes/patk_nickell/cmb2/includes/CMB2_Utils.php on line 145

    Notice: A non well formed numeric value encountered in ../wp-content/themes/patk_nickell/cmb2/includes/CMB2_Utils.php on line 152

    Notice: Undefined offset: 1 in ../wp-content/themes/patk_nickell/cmb2/includes/CMB2_Utils.php on line 137

    Notice: A non well formed numeric value encountered in ../public_html/wp-includes/media.php on line 445

    Notice: Undefined offset: 1 in ../wp-content/themes/patk_nickell/cmb2/includes/CMB2_Utils.php on line 145

    Notice: A non well formed numeric value encountered in ../wp-content/themes/patk_nickell/cmb2/includes/CMB2_Utils.php on line 152

    Notice: Undefined offset: 1 in ../wp-content/themes/patk_nickell/cmb2/includes/CMB2_Utils.php on line 168

    I searched all over stack overflow and your cmb2 documentation without any real success. I downloaded the lateset from github and set up the lib on WP 5.5.1 site on an Apache server with PHP 7.3.20 earlier today when i was updating some other scripts.

    Can you offer any advice? I’ll be glad to share my code if you need to see that.

    Here are images: Pic 1 Pic 2

    Thanks in advance!

    • This topic was modified 5 months, 4 weeks ago by EliWbbr.
    • This topic was modified 5 months, 4 weeks ago by EliWbbr.
    • This topic was modified 5 months, 4 weeks ago by EliWbbr.

    The page I need help with: [log in to see the link]

Viewing 5 replies - 16 through 20 (of 20 total)
  • Thread Starter EliWbbr

    (@eliwbbr)

    Should it help, here is the code for the front end:

    
                        $boxcosts = get_post_meta( get_the_ID(), '_cmb2_box_cost_repeat_group', true );
                        echo '<tr>';
                            foreach ( (array) $boxcosts as $key => $boxcost ) {
                                echo '<td>';
                                    echo $boxcost['_cmb2_box_cost'];
                                echo '</td>';
                            };
                        echo '</tr>';
    
    Thread Starter EliWbbr

    (@eliwbbr)

    And here is the Product custom post type:

    `
    <?php
    function codex_cpt_init() {
    // PRODUCTS
    $labels_product = array(
    ‘name’ => _x(‘Products’, ‘post type general name’),
    ‘singular_name’ => _x(‘Product’, ‘post type singular name’),
    ‘add_new’ => _x(‘Add New’, ‘product’),
    ‘add_new_item’ => __(‘Add New Product’),
    ‘edit_item’ => __(‘Edit Product’),
    ‘new_item’ => __(‘New Product’),
    ‘view_item’ => __(‘View Product’),
    ‘search_items’ => __(‘Search Products’),
    ‘not_found’ => __(‘No products found’),
    ‘not_found_in_trash’ => __(‘No products found in Trash’),
    ‘parent_item_colon’ => ”,
    ‘menu_name’ => ‘Products’
    );
    $args_product = array(
    ‘labels’ => $labels_product,
    ‘public’ => true,
    ‘publicly_queryable’ => true,
    ‘show_ui’ => true,
    ‘show_in_menu’ => true,
    ‘query_var’ => true,
    ‘rewrite’ => true,
    ‘capability_type’ => ‘post’,
    ‘has_archive’ => true,
    ‘hierarchical’ => false,
    //’menu_position’ => 25,
    ‘menu_icon’ => get_bloginfo(‘template_url’) . ‘/img/icon-products.png’,
    ‘supports’ => array(‘title’,’editor’,’thumbnail’) //,’excerpt’
    );
    register_post_type( ‘product’, $args_product );
    }
    add_action( ‘init’, ‘codex_cpt_init’ );
    ?>

    Plugin Author Michael Beckwith

    (@tw2113)

    The BenchPresser

    Not worried about either of those parts, as they’re not a part of the issue.

    I just don’t want you specifying some object types for your group field to see if that gets the error removed and resolved and you back to a working website.

    Thread Starter EliWbbr

    (@eliwbbr)

    This worked!! Oh my gosh thank you so so much for your time and patience 🙂

    If I could I’d buy you a coffee (or a pint)

    Thanks again Mr. Beckwith!

    Plugin Author Michael Beckwith

    (@tw2113)

    The BenchPresser

    A rating on the plugin is more than enough here, thanks Eli.

Viewing 5 replies - 16 through 20 (of 20 total)
  • You must be logged in to reply to this topic.