WPBuddy / largo

A WordPress framework for news websites. Finely-crafted by INN and expertly-honed and maintained by the technology team at WP Buddy.
http://largo.wpbuddy.co
GNU General Public License v2.0
171 stars 83 forks source link

Undefined variable: term_meta /largo/inc/taxonomy-archive-sidebars.php line 45 #1454

Open jonathanstegall opened 7 years ago

jonathanstegall commented 7 years ago

I get this error when I have custom taxonomy fields, using CMB2, on /wp-admin/edit-tags.php?taxonomy=category but not on /wp-admin/term.php?taxonomy=category&tag_ID=8022&post_type=post&wp_http_referer=%2Fwp-admin%2Fedit-tags.php%3Ftaxonomy%3Dcategory for example.

Full error:

[Fri Jul 21 10:22:50.138808 2017] [:error] [pid 7116] [client 127.0.0.1:62550] PHP Notice:  Undefined variable: term_meta in /wp-content/themes/largo/inc/taxonomy-archive-sidebars.php on line 45, referer: https://minnpost-wordpress.dev/wp-admin/

Here's how my category is set up:

// CMB2 custom fields for categories
add_action( 'cmb2_init', 'cmb2_category_fields' );
function cmb2_category_fields() {

    $object_type = 'term';

    /**
     * Subtitle settings
     */
    $category_setup = new_cmb2_box( array(
        'id'            => 'category_properties',
        'title'         => 'Subtitle Settings',
        'object_types'  => array( $object_type ),
        'taxonomies'    => array( 'category' ),
        'new_term_section' => true, // will display in add category section
    ) );
    $category_setup->add_field( array(
        'name'       => 'Excerpt',
        'id'         => '_mp_category_excerpt',
        'type'       => 'wysiwyg',
    ) );
    $category_setup->add_field( array(
        'name'       => 'Sponsorship',
        'id'         => '_mp_category_sponsorship',
        'type'       => 'wysiwyg',
    ) );
    $category_setup->add_field( array(
        'name'       => 'Category Thumbnail',
        'id'         => '_mp_category_thumbnail_id',
        'type'       => 'file',
    ) );
    $category_setup->add_field( array(
        'name'       => 'Category Main Image',
        'id'         => '_mp_category_main_image_id',
        'type'       => 'file',
    ) );
    $category_setup->add_field( array(
        'name'       => 'Body',
        'id'         => '_mp_category_body',
        'type'       => 'wysiwyg',
    ) );
}

I did try 'new_term_section' => true, // will display in add category section with both true and false, and the error still appeared both ways.

benlk commented 7 years ago

In which branch of Largo?

jonathanstegall commented 7 years ago

Sorry, 1.0. I thought I put that in there but I forgot.