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 would like to display the full list of categories on the Page creation page, so that the user can pick using checkboxes which category posts should appear on that page.

where I would like to display it

I then need to retrieve the chosen categories for that specific page in my custom page templates, so that I can modify my loop to filter for only those chosen categories.

share|improve this question
thanks for the edit bungeshea – Kayo Feb 7 '13 at 10:00
up vote 2 down vote accepted

By default page post type doesn't support category taxonomy. But you can easily fix it by register category taxonomy for page post type:

add_action( 'init', 'wpse8170_init' );
function wpse8170_init() {
    register_taxonomy_for_object_type( 'category', 'page' );

Now you will see categories meta box in the same place as you see it at post creation page.

To get page's categories just call wp_get_post_categories function like this (thanks to @Subharanjan):

$page_categories = wp_get_post_categories( get_the_ID() ); 
share|improve this answer
How beautifully simple! how would I retrieve the chosen categories on their respective pages? – Kayo Feb 7 '13 at 11:00
to be clear, I already have the code to loop through a selection of categories, I just need to retrieve the list of chosen categories to use as arguments in my existing loop. – Kayo Feb 7 '13 at 11:01
@Kayo updated my answer – Eugene Manuilov Feb 7 '13 at 11:26
$page_categories = wp_get_post_categories( get_the_ID() ); 

Pass the current page id/ any pageid as the param and get the asociated categories.

share|improve this answer
thank you, just what I needed – Kayo Feb 7 '13 at 11:24

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.