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'm trying to add the categories selector to the "page" editor workspace. The code below does the trick, however, none of the values are saved with the page.

Any help much appreciated!

add_action('admin_menu', 'my_post_categories_meta_box');
function my_post_categories_meta_box() {
    add_meta_box('categorydiv', __('Categories'),      
   'post_categories_meta_box', 'page', 'side', 'core');
share|improve this question
up vote 2 down vote accepted

You'll need to register the category taxonomy for the page post_type with register_taxonomy_for_object_type.

This does the trick:

add_action( 'init', 'wpse34528_add_page_cats' );
function wpse34528_add_page_cats()
    register_taxonomy_for_object_type( 'category', 'page' );
share|improve this answer
+1 Excellent! Is my code above sufficient or is there another way to do that as well? – N2Mystic Nov 23 '11 at 15:34
You actually don't need the code you posted. Just using the snippet I posed will add the meta box and make sure the stuff gets saved, etc. – chrisguitarguy Nov 23 '11 at 15:44
Incredible. Why doesn't WP come this way out of the box? – N2Mystic Nov 23 '11 at 16:06

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.