Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

1 Answer 1

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

 
discard

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.