I'm trying to retrieve the TaxonomyAdvanced from MB Settings Page, but I don't understand why I'm getting Null:
$meta_boxes[] = array(
'id' => 'activate_c',
'title' => __( 'Active c', 'textdomain' ),
'settings_pages' => $prefix .'c_settings',
'context' => 'advanced',
'priority' => 'high',
'autosave' => true,
'fields' => array(
array(
'name' => esc_html__( 'Activete C', 'textdomain' ),
'id' => 'cc_activate',
'type' => 'checkbox',
),
array(
'name' => esc_html__( 'CC', 'textdomain' ),
'id' => $prefix . 'cc_date',
'type' => 'datetime',
'timestamp' => true,
'visible' => ['cc_activate', true] // Visible if checkbox_field is checked
),
array(
'name' => esc_html__( 'CC Select', 'textdomain' ),
'id' => $prefix .'cc_connect',
'type' => 'taxonomy_advanced',
'taxonomy' => 'brand',
'field_type' => 'select_advanced',
'visible' => ['cc_activate', true]
),
),
);
And I'm trying torequest this info as a test:
if (!function_exists('cc_slug')):
function cc_slug()
{
global $prefix;
$terms = rwmb_meta( $prefix . 'cc_connect' );
$content = '';
if ( !empty( $terms ) ) {
$content .= '<ul>';
foreach ( $terms as $term ) {
$content .= sprintf(
'<li><a title="%s" href="%s">%s</a></li>',
esc_attr( $term->name ),
esc_url( get_term_link( $term, 'tax_slug' ) ),
esc_html( $term->name )
);
}
}
echo $content;
}
endif;
I get in var_dump(cc_slug()); NULL
So I really do not understand how exactly Taxonomy Advanced work.
thank you