Loading...


Loading...

Welcome!

Sign up for a free account, or log in here.

Member Login

You can login by following the link.

Not a Member? Sign up! It's Free!

Please feel free to register.

Click to log in.

Removing Category Meta Box from Post/Page

Another little code snippet that you might find useful. This removes the ‘category’ meta box on post/page editing pages.

First of all you need to use an add_action() to hook into admin_head:

add_action(‘admin_head’, ‘theme_page_head’);

This then calls your defined function in the functions.php file, ‘theme_page_head’ like so:

function theme_page_head() {
 if (!current_user_can(‘administrator’)) {
  remove_meta_box(‘categorydiv’, ‘post’, ‘side’);
 }
}

Here we call the remove_meta_box() function, with the ‘categorydiv’ as first argument, the type of page we’re targeting (post/page/link, or registered custom post type) as the second argument, and then the context (normal/advanced/side) where it would normally appear. Voila the category box has gone.

To get more information on this you should see WordPress’ remove_meta_box() Codex entry, as there is more information on there as well as a list of some of the possible meta boxes available to target.



Leave a Reply



You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>


The English Guy on Twitter

Raised Paper WordPress Theme

Raised Paper WordPress Theme screenshot
Theme Price

Onyx WordPress Theme

Onyx WordPress Theme screenshot
Theme Price

Victoriana WordPress Theme

Victoriana WordPress Theme screenshot
Theme Price

Expression Blue WordPress Theme

Expression Blue WordPress Theme screenshot
Theme Price

Premium WordPress Theme Release: Natural Green

Premium WordPress Theme Release: Natural Green screenshot
Theme Price

Theme Release: Ikon WordPress Theme

Theme Release: Ikon WordPress Theme screenshot
Theme Price

Shocking WordPress Theme Release

Shocking WordPress Theme Release screenshot
Theme Price

Digitalis WordPress Theme Release

Digitalis WordPress Theme Release screenshot
Theme Price

WordPress Theme: OpenAir Theme

WordPress Theme: OpenAir Theme screenshot
Theme Price

WordPress Theme: Very English

WordPress Theme: Very English screenshot
Theme Price

News Print v3.0 WordPress Theme Released

News Print v3.0 WordPress Theme Released screenshot
Theme Price

Reclamation WordPress Theme

Reclamation WordPress Theme screenshot
Theme Price