This one might be a simple question, but it's driving me nuts :)
I'm trying to make an admin settings page on the wp-admin
side for which I need to get all the values of a certain category.
This is part of my test code:
$terms = get_terms( array(
'taxonomy' => 'my-category',
'hide_empty' => false,
) );
echo '<pre>';
var_dump($terms);
echo '</pre>';
But this returns an error. Something like "invalid taxonomy"
.
When I leave the 'taxonomy'
arg from get_terms()
it returns all the terms successfully. ( but of course I need to filter it by my tax term.
Anyone knows what's up? :)
Any help would be highly appreciated.
Please try this code
https://developer.wordpress.org/reference/functions/get_terms/