I’ve got a weird problem. For only some categories (2 of 7), I can’t get their name. On archive.php I have this code :
$cat = get_category( get_query_var( 'cat' ) ); $cat_id = $cat->cat_ID; $cat_name = $cat->name;
I got this error when printing
$cat = get_category( get_query_var( 'cat' ) );:
WP_Error Object ( [errors] => Array ( [invalid_term] => Array (  => Pas de terme ) ) [error_data] => Array ( ) )
This is really strange, cause the default loop can retrieve the posts of the category who is being watched. And for others categories, this works well…
Thanks for any suggestions 🙂
- The topic ‘Can't get some categories's name on archive.php’ is closed to new replies.