• Resolved wiloke

    (@wiloke)


    Hi,
    How to get term meta to print to the front end?
    My back-end code

    array(
    		'id'            => 'listing_category_settings',
    		'title'         => esc_html__('Settings', WILOKE_LISTING_DOMAIN),
    		'object_types'  => array('term'),
    		'taxonomies'    => array('listing_cat'),
    		'new_term_section'=> true,
    		'context'       => 'normal',
    		'priority'      => 'low',
    		'save_field'    => true,
    		'show_names'    => true, // Show field names on the left
    		'fields'        => array(
    			array(
    				'type'      => 'taxonomy_multicheck',
    				'taxonomy'  => 'listing_tag',
    				'id'        => $prefix.'tags_children',
    				'name'      => esc_html__('Set Tags belong to this category', WILOKE_LISTING_DOMAIN)
    			)
    		)
    	)
    

    I tried get_term_meta but it didn’t work

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter wiloke

    (@wiloke)

    I solved it my self.
    cmb2 -> includes -> CMB2_Field.php -> line 471

    false === $cb

    if the callback function is empty, it will return NULL

    and because of you’re using false === $cb => return call_user_func( $cb, $meta_value, $this->args(), $this ); will be executed => return null.
    Thanks

    • This reply was modified 6 years, 9 months ago by wiloke.
    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Just to be certain, instead of having to tweak/touch the CMB2 core files, were you making sure to pass the term ID to get_term_meta() as opposed to the post ID?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to get term meta’ is closed to new replies.