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 created my own custom Wordpress theme for my website, everything is great. However, I have a strange need, I have one category which is kind of a 'placeholder' for content which is automated and used by an automated background process. Each time this process finds new content to put into that category I end up with another entry when I go to the admin screen to post or edit any of the posts which I manually enter. Since it is more than just myself, I really want a way to just completely hide that one category from being shown in the Admin 'Edit/Post' screen to keep it nice and lean.

I've poked around in some of the source code files, however, I have come to the point of frustration. Been searching around on Google and other places for any idea, yet, keep coming up empty.

Does anyone know how to do this, or even IF it can be done?

Thanks,

Derek

share|improve this question
add comment

2 Answers

The only solution I could imagine is removing, rewriting, replacing the meta box.

// First remove the original one
function wpse21483_remove_catbox()
{
    remove_meta_box( 'post_categories_meta_box', 'post', 'side' );
}
add_action( 'admin_menu', 'wpse21483_remove_catbox' ); // not sure about the hook

function wpse21483_new_catbox()
{
    // re-define - take a look at /wp-admin/include/metaboxes.php
}
// Hook the new one
add_action( 'add_meta_boxes', 'wpse21483_new_catbox' );

Edit: Maybe you can use a the filter for the categories dropdown

function wpse21483_alter_catbox( $output )
{
    global $current_screen;
    $id = $current_screen->id;
    // abort if not on post screen
    if ( $id !== 'post' )
        return;

    // search/replace the category
    return $output;
}
add_filter( 'wp_dropdown_cats', 'wpse21483_alter_catbox', 10, 1 )
share|improve this answer
    
I assume, to use that, I would place it in my functions file? –  dcolanduno Jul 1 '11 at 11:41
    
Yes, functions.php is a good place for custom hacks. But you still have to define the search/replace. See the line where I commented that. For a start, replace the comment line with echo '<pre>'; print_r($output); echo '</pre>'; to see how $output is currently built. –  kaiser Jul 3 '11 at 16:37
add comment

I have used a plugin called Ultimate Category Excluder Easily exclude categories from your front page, feeds, search , and archives

http://www.planetmike.com/plugins/ultimate-category-excluder/

it worked for me :)

Hope this is an easy fix

share|improve this answer
add comment

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.