WordPress.org

Support

Support » How-To and Troubleshooting » Display list of categories for a particular post

Display list of categories for a particular post

  • Hi,
    Im really blank at the moment, been a long day. I need to output a list of categories associated to a post. I have been using <?php echo wp_get_post_categories( $post_id, $args ) ?> but all is get is the word “Array”. I also tried putting this into a foreach loop with no luck. Just need to display the categories that are given to a post.
    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • I could be wrong, but I think that only gets categories specified by ID in an array, I think all you need is

    <?php the_category();?>

    I looked up wp_get_post_categories, I’m not quite sure what it does. The initail description is a zinger.

    Compatibility layer for themes and plugins. Also an easy layer of abstraction away from the complexity of the taxonomy layer.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Display list of categories for a particular post’ is closed to new replies.