get_the_category() returns an empty value
-
Hello
I understood every bit of the description given for get_the_category() in Codex, but cannot make the function retrieve anything but an empty value using code in the following format:
$categories = get_the_category(5);
if ( ! empty( $categories ) ) {
echo esc_html( $categories[0]->name );I made absolutely sure the correct category ID is 5 in the admin screen. What could possibly prevent get_the_category() from retrieving the category name? I spent a day googling solutions but could not find a solution that works for the life of me.
The page I need help with: [log in to see the link]
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘get_the_category() returns an empty value’ is closed to new replies.