WordPress.org

Ready to get started?Download WordPress

Forums

Display list of categories for a particular post (3 posts)

  1. binga30
    Member
    Posted 1 year ago #

    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

  2. deepbevel
    Member
    Posted 1 year ago #

    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();?>
  3. deepbevel
    Member
    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic