get_terms() broken
-
Hi,
Im using this plugin to order the taxonomies of my CPT, but when I enable the plugin the get_terms() function stops returning the taxonomies and returns an empty array instead. If I disable the plugin all goes back to normal and it prints all my taxonomies.
This is the code I use:
register_post_type(
'products',
array(
'labels' => array(
'name' => __('Productes', 'ssll'),
'singular_name' => __('Producte', 'ssll')
),
'public' => true,
'has_archive' => false, // False Si no te archive page
'menu_position' => 22,
'menu_icon' => 'dashicons-image-filter',
'supports' => array('title', 'editor', 'thumbnail'),
'rewrite' => array('with_front' => false),
)
);
register_taxonomy(
'prod-categories', // The name of the taxonomy. Name should be in slug form (must not contain capital letters or spaces).
'products', // post type name in lowercase (not slug)
array(
'hierarchical' => true,
'label' => 'Categoríes', // display name
'query_var' => true,
'show_admin_column' => true, // Display in backoffice's post_type table
'rewrite' => array(
'slug' => 'prod-category', // This controls the base slug that will display before each term
'with_front' => false // Don't display the category base before
)
)
);I then use the following code to print the taxonomy:
$prod_tax = get_terms(array(‘taxonomy’ => ‘prod-categories’));
var_dump($prod_tax);
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
The topic ‘get_terms() broken’ is closed to new replies.