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'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

1 Answer 1

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:

<?php
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

 
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.