function post_categories_meta_box( $post, $box ) {}

Display post categories form fields.


  • object $post
  • $box

Source code

function post_categories_meta_box( $post, $box ) {

	$defaults = array('taxonomy' => 'category');

	if ( !isset($box['args']) || !is_array($box['args']) )

		$args = array();


		$args = $box['args'];

	extract( wp_parse_args($args, $defaults), EXTR_SKIP );

	$tax = get_taxonomy($taxonomy);


	<div id="taxonomy-<?php echo $taxonomy; ?>" class="categorydiv">

		<ul id="<?php echo $taxonomy; ?>-tabs" class="category-tabs">

			<li class="tabs"><a href="#<?php echo $taxonomy; ?>-all" tabindex="3"><?php echo $tax->labels->all_items; ?></a></li>

			<li class="hide-if-no-js"><a href="#<?php echo $taxonomy; ?>-pop" tabindex="3"><?php _e( 'Most Used' ); ?></a></li>


		<div id="<?php echo $taxonomy; ?>-pop" class="tabs-panel" style="display: none;">

			<ul id="<?php echo $taxonomy; ?>checklist-pop" class="categorychecklist form-no-clear" >

				<?php $popular_ids = wp_popular_terms_checklist($taxonomy); ?>



		<div id="<?php echo $taxonomy; ?>-all" class="tabs-panel">


            $name = ( $taxonomy == 'category' ) ? 'post_category' : 'tax_input[' . $taxonomy . ']';

            echo "<input type='hidden' name='{$name}[]' value='0' />"; // Allows for an empty term set to be sent. 0 is an invalid Term ID and will be ignored by empty() checks.


No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: