I have a custom function to make an excerpt for our posts, and in that function I can get the post title like this:
$post_title = get_the_title();
And the text of the post with this:
$text = get_the_content(”);
But for various reasons I need to get the category of the post, and I don’t see how to do that.
Any advice for that?
- The topic ‘Getting the post category in functions.php?’ is closed to new replies.