WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a custom meta box added to the Page edit screen. I also have categories turned on for Pages.

I'm using get_categories($post->ID); to retrieve a list of categories, as you would in a page template, but it returns a list of all categories instead of just the ones selected.

Is it possible to only return selected categories?

Thank you.

share|improve this question
up vote 0 down vote accepted

Figured it out, I was using the wrong function.

Correct function was get_the_category_by_ID($cat);

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.