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.

1 Answer 1


Figured it out, I was using the wrong function.

Correct function was get_the_category_by_ID($cat);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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