• Resolved jayschmidt

    (@jayschmidt)


    Hi,
    I’m just improving an older global posts plugin and have problems getting the categories (now terms) for a given $post_id.

    The plugin operates outside of the loop so I can’t use any of the functions that are used in the loop.

    I looked into the functions but couldn’t find the right one. get_terms() sound promising but I have no idea what I could pass to it.

    Any help or pointer in the right direction would be great!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Well, get_the_category($id) is probably your best bet.

    The codex is not up to date on all the new possible uses. Many of the older Loop only tags can take a post id as a parameter now.

    Thread Starter jayschmidt

    (@jayschmidt)

    Perfect that does it. I just thought I can only use this function within in the loop! Thanks a lot!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Getting the terms/categories for a $post_id’ is closed to new replies.