WordPress by example: get_the_category()
I was working on a sidebar template and needed to get the category information for the page. Since I had the post ID, it was simple to get the category information with get_the_category(). When I pass in the post ID, it will return a WP_Term[] (an array of WP_Term objects). In this example, I request all posts in… Read More »