<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[12694] trunk: Show custom hierarchical taxonomies in the menus.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/12694">12694</a></dd>
<dt>Author</dt> <dd>ryan</dd>
<dt>Date</dt> <dd>2010-01-11 19:27:44 +0000 (Mon, 11 Jan 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Show custom hierarchical taxonomies in the menus. Props dd32. see <a href="http://trac.wordpress.org/ticket/11838">#11838</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadmincategoriesphp">trunk/wp-admin/categories.php</a></li>
<li><a href="#trunkwpadminincludestaxonomyphp">trunk/wp-admin/includes/taxonomy.php</a></li>
<li><a href="#trunkwpadminincludestemplatephp">trunk/wp-admin/includes/template.php</a></li>
<li><a href="#trunkwpadminmenuphp">trunk/wp-admin/menu.php</a></li>
<li><a href="#trunkwpincludescategorytemplatephp">trunk/wp-includes/category-template.php</a></li>
<li><a href="#trunkwpincludescategoryphp">trunk/wp-includes/category.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadmincategoriesphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/categories.php (12693 => 12694)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/categories.php        2010-01-11 18:53:52 UTC (rev 12693)
+++ trunk/wp-admin/categories.php        2010-01-11 19:27:44 UTC (rev 12694)
</span><span class="lines">@@ -11,8 +11,26 @@
</span><span class="cx"> 
</span><span class="cx"> $title = __('Categories');
</span><span class="cx"> 
</span><del>-wp_reset_vars( array('action') );
</del><ins>+wp_reset_vars( array('action', 'taxonomy', 'post_type') );
</ins><span class="cx"> 
</span><ins>+if ( empty($taxonomy) )
+        $taxonomy = 'category';
+
+if ( !is_taxonomy($taxonomy) )
+        wp_die(__('Invalid taxonomy'));
+
+if ( empty($post_type) || !in_array( $post_type, get_post_types( array('_show' =&gt; true) ) ) )
+        $post_type = 'post';
+
+if ( 'post' != $post_type ) {
+        $parent_file = &quot;edit.php?post_type=$post_type&quot;;
+        $submenu_file = &quot;categories.php?taxonomy=$taxonomy&amp;amp;post_type=$post_type&quot;;
+} else {
+        $parent_file = 'edit.php';
+        $submenu_file = &quot;categories.php?taxonomy=$taxonomy&quot;;        
+}
+
+
</ins><span class="cx"> if ( isset( $_GET['action'] ) &amp;&amp; isset($_GET['delete']) &amp;&amp; ( 'delete' == $_GET['action'] || 'delete' == $_GET['action2'] ) )
</span><span class="cx">         $action = 'bulk-delete';
</span><span class="cx"> 
</span><span class="lines">@@ -135,7 +153,7 @@
</span><span class="cx"> &lt;div class=&quot;wrap nosubsub&quot;&gt;
</span><span class="cx"> &lt;?php screen_icon(); ?&gt;
</span><span class="cx"> &lt;h2&gt;&lt;?php echo esc_html( $title );
</span><del>-if ( isset($_GET['s']) &amp;&amp; $_GET['s'] )
</del><ins>+if ( !empty($_GET['s']) )
</ins><span class="cx">         printf( '&lt;span class=&quot;subtitle&quot;&gt;' . __('Search results for &amp;#8220;%s&amp;#8221;') . '&lt;/span&gt;', esc_html( stripslashes($_GET['s']) ) ); ?&gt;
</span><span class="cx"> &lt;/h2&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -146,6 +164,8 @@
</span><span class="cx"> endif; ?&gt;
</span><span class="cx"> 
</span><span class="cx"> &lt;form class=&quot;search-form topmargin&quot; action=&quot;&quot; method=&quot;get&quot;&gt;
</span><ins>+&lt;input type=&quot;hidden&quot; name=&quot;taxonomy&quot; value=&quot;&lt;?php echo esc_attr($taxonomy); ?&gt;&quot; /&gt;
+&lt;input type=&quot;hidden&quot; name=&quot;post_type&quot; value=&quot;&lt;?php echo esc_attr($post_type); ?&gt;&quot; /&gt;
</ins><span class="cx"> &lt;p class=&quot;search-box&quot;&gt;
</span><span class="cx">         &lt;label class=&quot;screen-reader-text&quot; for=&quot;category-search-input&quot;&gt;&lt;?php _e('Search Categories'); ?&gt;:&lt;/label&gt;
</span><span class="cx">         &lt;input type=&quot;text&quot; id=&quot;category-search-input&quot; name=&quot;s&quot; value=&quot;&lt;?php _admin_search_query(); ?&gt;&quot; /&gt;
</span><span class="lines">@@ -159,6 +179,8 @@
</span><span class="cx"> &lt;div id=&quot;col-right&quot;&gt;
</span><span class="cx"> &lt;div class=&quot;col-wrap&quot;&gt;
</span><span class="cx"> &lt;form id=&quot;posts-filter&quot; action=&quot;&quot; method=&quot;get&quot;&gt;
</span><ins>+&lt;input type=&quot;hidden&quot; name=&quot;taxonomy&quot; value=&quot;&lt;?php echo esc_attr($taxonomy); ?&gt;&quot; /&gt;
+&lt;input type=&quot;hidden&quot; name=&quot;post_type&quot; value=&quot;&lt;?php echo esc_attr($post_type); ?&gt;&quot; /&gt;
</ins><span class="cx"> &lt;div class=&quot;tablenav&quot;&gt;
</span><span class="cx"> 
</span><span class="cx"> &lt;?php
</span><span class="lines">@@ -172,9 +194,9 @@
</span><span class="cx"> $cats_per_page = apply_filters( 'edit_categories_per_page', $cats_per_page );
</span><span class="cx"> 
</span><span class="cx"> if ( !empty($_GET['s']) )
</span><del>-        $num_cats = count(get_categories(array('hide_empty' =&gt; 0, 'search' =&gt; $_GET['s'])));
</del><ins>+        $num_cats = count(get_categories(array('taxonomy' =&gt; $taxonomy, 'hide_empty' =&gt; 0, 'search' =&gt; $_GET['s'])));
</ins><span class="cx"> else
</span><del>-        $num_cats = wp_count_terms('category');
</del><ins>+        $num_cats = wp_count_terms($taxonomy);
</ins><span class="cx"> 
</span><span class="cx"> $page_links = paginate_links( array(
</span><span class="cx">         'base' =&gt; add_query_arg( 'pagenum', '%#%' ),
</span><span class="lines">@@ -218,7 +240,7 @@
</span><span class="cx"> 
</span><span class="cx">         &lt;tbody id=&quot;the-list&quot; class=&quot;list:cat&quot;&gt;
</span><span class="cx"> &lt;?php
</span><del>-cat_rows(0, 0, 0, $pagenum, $cats_per_page);
</del><ins>+cat_rows(0, 0, 0, $pagenum, $cats_per_page, $taxonomy);
</ins><span class="cx"> ?&gt;
</span><span class="cx">         &lt;/tbody&gt;
</span><span class="cx"> &lt;/table&gt;
</span><span class="lines">@@ -244,8 +266,12 @@
</span><span class="cx"> &lt;/form&gt;
</span><span class="cx"> 
</span><span class="cx"> &lt;div class=&quot;form-wrap&quot;&gt;
</span><del>-&lt;p&gt;&lt;?php printf(__('&lt;strong&gt;Note:&lt;/strong&gt;&lt;br /&gt;Deleting a category does not delete the posts in that category. Instead, posts that were only assigned to the deleted category are set to the category &lt;strong&gt;%s&lt;/strong&gt;.'), apply_filters('the_category', get_cat_name(get_option('default_category')))) ?&gt;&lt;/p&gt;
</del><ins>+&lt;?php if ( get_option('default_' . $taxonomy) ) : ?&gt;
+&lt;p&gt;&lt;?php printf(__('&lt;strong&gt;Note:&lt;/strong&gt;&lt;br /&gt;Deleting a %1$s does not delete the objects in that %1$s. Instead, objects that were only assigned to the deleted %1$s are set to the %1$s &lt;strong&gt;%2$s&lt;/strong&gt;.'), $tax-&gt;label, apply_filters('the_category', get_cat_name(get_option('default_' . $taxonomy)))) ?&gt;&lt;/p&gt;
+&lt;?php endif; ?&gt;
+&lt;?php if ( 'category' == $taxonomy ) : ?&gt;
</ins><span class="cx"> &lt;p&gt;&lt;?php printf(__('Categories can be selectively converted to tags using the &lt;a href=&quot;%s&quot;&gt;category to tag converter&lt;/a&gt;.'), 'admin.php?import=wp-cat2tag') ?&gt;&lt;/p&gt;
</span><ins>+&lt;?php endif; ?&gt;
</ins><span class="cx"> &lt;/div&gt;
</span><span class="cx"> 
</span><span class="cx"> &lt;/div&gt;
</span><span class="lines">@@ -261,6 +287,8 @@
</span><span class="cx"> &lt;h3&gt;&lt;?php _e('Add Category'); ?&gt;&lt;/h3&gt;
</span><span class="cx"> &lt;div id=&quot;ajax-response&quot;&gt;&lt;/div&gt;
</span><span class="cx"> &lt;form name=&quot;addcat&quot; id=&quot;addcat&quot; method=&quot;post&quot; action=&quot;categories.php&quot; class=&quot;add:the-list: validate&quot;&gt;
</span><ins>+&lt;input type=&quot;hidden&quot; name=&quot;taxonomy&quot; value=&quot;&lt;?php echo esc_attr($taxonomy); ?&gt;&quot; /&gt;
+&lt;input type=&quot;hidden&quot; name=&quot;post_type&quot; value=&quot;&lt;?php echo esc_attr($post_type); ?&gt;&quot; /&gt;
</ins><span class="cx"> &lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;addcat&quot; /&gt;
</span><span class="cx"> &lt;?php wp_original_referer_field(true, 'previous'); wp_nonce_field('add-category'); ?&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -278,7 +306,7 @@
</span><span class="cx"> 
</span><span class="cx"> &lt;div class=&quot;form-field&quot;&gt;
</span><span class="cx">         &lt;label for=&quot;category_parent&quot;&gt;&lt;?php _e('Category Parent') ?&gt;&lt;/label&gt;
</span><del>-        &lt;?php wp_dropdown_categories(array('hide_empty' =&gt; 0, 'name' =&gt; 'category_parent', 'orderby' =&gt; 'name', 'selected' =&gt; $category-&gt;parent, 'hierarchical' =&gt; true, 'show_option_none' =&gt; __('None'))); ?&gt;
</del><ins>+        &lt;?php wp_dropdown_categories(array('hide_empty' =&gt; 0, 'hide_if_empty' =&gt; false, 'taxonomy' =&gt; $taxonomy, 'name' =&gt; 'category_parent', 'orderby' =&gt; 'name', 'selected' =&gt; $category-&gt;parent, 'hierarchical' =&gt; true, 'show_option_none' =&gt; __('None'))); ?&gt;
</ins><span class="cx">     &lt;p&gt;&lt;?php _e('Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have children categories for Bebop and Big Band. Totally optional.'); ?&gt;&lt;/p&gt;
</span><span class="cx"> &lt;/div&gt;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkwpadminincludestaxonomyphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/taxonomy.php (12693 => 12694)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/taxonomy.php        2010-01-11 18:53:52 UTC (rev 12693)
+++ trunk/wp-admin/includes/taxonomy.php        2010-01-11 19:27:44 UTC (rev 12694)
</span><span class="lines">@@ -108,7 +108,7 @@
</span><span class="cx">  * @return unknown
</span><span class="cx">  */
</span><span class="cx"> function wp_insert_category($catarr, $wp_error = false) {
</span><del>-        $cat_defaults = array('cat_ID' =&gt; 0, 'cat_name' =&gt; '', 'category_description' =&gt; '', 'category_nicename' =&gt; '', 'category_parent' =&gt; '');
</del><ins>+        $cat_defaults = array('cat_ID' =&gt; 0, 'taxonomy' =&gt; 'category', 'cat_name' =&gt; '', 'category_description' =&gt; '', 'category_nicename' =&gt; '', 'category_parent' =&gt; '');
</ins><span class="cx">         $catarr = wp_parse_args($catarr, $cat_defaults);
</span><span class="cx">         extract($catarr, EXTR_SKIP);
</span><span class="cx"> 
</span><span class="lines">@@ -142,9 +142,9 @@
</span><span class="cx">         $args = compact('name', 'slug', 'parent', 'description');
</span><span class="cx"> 
</span><span class="cx">         if ( $update )
</span><del>-                $cat_ID = wp_update_term($cat_ID, 'category', $args);
</del><ins>+                $cat_ID = wp_update_term($cat_ID, $taxonomy, $args);
</ins><span class="cx">         else
</span><del>-                $cat_ID = wp_insert_term($cat_name, 'category', $args);
</del><ins>+                $cat_ID = wp_insert_term($cat_name, $taxonomy, $args);
</ins><span class="cx"> 
</span><span class="cx">         if ( is_wp_error($cat_ID) ) {
</span><span class="cx">                 if ( $wp_error )
</span></span></pre></div>
<a id="trunkwpadminincludestemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/template.php (12693 => 12694)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/template.php        2010-01-11 18:53:52 UTC (rev 12693)
+++ trunk/wp-admin/includes/template.php        2010-01-11 19:27:44 UTC (rev 12694)
</span><span class="lines">@@ -20,13 +20,13 @@
</span><span class="cx">  * @param unknown_type $page
</span><span class="cx">  * @param unknown_type $per_page
</span><span class="cx">  */
</span><del>-function cat_rows( $parent = 0, $level = 0, $categories = 0, $page = 1, $per_page = 20 ) {
</del><ins>+function cat_rows( $parent = 0, $level = 0, $categories = 0, $page = 1, $per_page = 20, $taxonomy = 'category' ) {
</ins><span class="cx"> 
</span><span class="cx">         $count = 0;
</span><span class="cx"> 
</span><span class="cx">         if ( empty($categories) ) {
</span><span class="cx"> 
</span><del>-                $args = array('hide_empty' =&gt; 0);
</del><ins>+                $args = array('hide_empty' =&gt; 0, 'taxonomy' =&gt; $taxonomy);
</ins><span class="cx">                 if ( !empty($_GET['s']) )
</span><span class="cx">                         $args['search'] = $_GET['s'];
</span><span class="cx"> 
</span><span class="lines">@@ -36,9 +36,9 @@
</span><span class="cx">                         return false;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        $children = _get_term_hierarchy('category');
</del><ins>+        $children = _get_term_hierarchy($taxonomy);
</ins><span class="cx"> 
</span><del>-        _cat_rows( $parent, $level, $categories, $children, $page, $per_page, $count );
</del><ins>+        echo _cat_rows( $parent, $level, $categories, $children, $page, $per_page, $count );
</ins><span class="cx"> 
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -53,14 +53,14 @@
</span><span class="cx">  * @param unknown_type $level
</span><span class="cx">  * @param unknown_type $page
</span><span class="cx">  * @param unknown_type $per_page
</span><del>- * @return unknown
</del><ins>+ * @return string the output of the table.
</ins><span class="cx">  */
</span><span class="cx"> function _cat_rows( $parent = 0, $level = 0, $categories, &amp;$children, $page = 1, $per_page = 20, &amp;$count ) {
</span><span class="cx"> 
</span><span class="cx">         $start = ($page - 1) * $per_page;
</span><span class="cx">         $end = $start + $per_page;
</span><del>-        ob_start();
</del><span class="cx"> 
</span><ins>+        $output = '';
</ins><span class="cx">         foreach ( $categories as $key =&gt; $category ) {
</span><span class="cx">                 if ( $count &gt;= $end )
</span><span class="cx">                         break;
</span><span class="lines">@@ -83,26 +83,23 @@
</span><span class="cx"> 
</span><span class="cx">                         $num_parents = count($my_parents);
</span><span class="cx">                         while( $my_parent = array_pop($my_parents) ) {
</span><del>-                                echo &quot;\t&quot; . _cat_row( $my_parent, $level - $num_parents );
</del><ins>+                                $output =  &quot;\t&quot; . _cat_row( $my_parent, $level - $num_parents );
</ins><span class="cx">                                 $num_parents--;
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 if ( $count &gt;= $start )
</span><del>-                        echo &quot;\t&quot; . _cat_row( $category, $level );
</del><ins>+                        $output .= &quot;\t&quot; . _cat_row( $category, $level );
</ins><span class="cx"> 
</span><span class="cx">                 unset( $categories[ $key ] );
</span><span class="cx"> 
</span><span class="cx">                 $count++;
</span><span class="cx"> 
</span><span class="cx">                 if ( isset($children[$category-&gt;term_id]) )
</span><del>-                        _cat_rows( $category-&gt;term_id, $level + 1, $categories, $children, $page, $per_page, $count );
</del><ins>+                        $output .= _cat_rows( $category-&gt;term_id, $level + 1, $categories, $children, $page, $per_page, $count );
</ins><span class="cx">         }
</span><span class="cx"> 
</span><del>-        $output = ob_get_contents();
-        ob_end_clean();
-
-        echo $output;
</del><ins>+        return $output;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><span class="lines">@@ -2568,7 +2565,7 @@
</span><span class="cx"> ?&gt;
</span><span class="cx"> &lt;/select&gt;
</span><span class="cx"> &lt;input class=&quot;hide-if-js&quot; type=&quot;text&quot; id=&quot;metakeyinput&quot; name=&quot;metakeyinput&quot; tabindex=&quot;7&quot; value=&quot;&quot; /&gt;
</span><del>-&lt;a href=&quot;#postcustomstuff&quot; class=&quot;hide-if-no-js&quot; onClick=&quot;jQuery('#metakeyinput, #metakeyselect, #enternew, #cancelnew').toggle();return false;&quot;&gt;
</del><ins>+&lt;a href=&quot;#postcustomstuff&quot; class=&quot;hide-if-no-js&quot; onclick=&quot;jQuery('#metakeyinput, #metakeyselect, #enternew, #cancelnew').toggle();return false;&quot;&gt;
</ins><span class="cx"> &lt;span id=&quot;enternew&quot;&gt;&lt;?php _e('Enter new'); ?&gt;&lt;/span&gt;
</span><span class="cx"> &lt;span id=&quot;cancelnew&quot; class=&quot;hidden&quot;&gt;&lt;?php _e('Cancel'); ?&gt;&lt;/span&gt;&lt;/a&gt;
</span><span class="cx"> &lt;?php } else { ?&gt;
</span><span class="lines">@@ -3239,7 +3236,7 @@
</span><span class="cx">                                 &lt;?php wp_nonce_field( 'find-posts', '_ajax_nonce', false ); ?&gt;
</span><span class="cx">                                 &lt;label class=&quot;screen-reader-text&quot; for=&quot;find-posts-input&quot;&gt;&lt;?php _e( 'Search' ); ?&gt;&lt;/label&gt;
</span><span class="cx">                                 &lt;input type=&quot;text&quot; id=&quot;find-posts-input&quot; name=&quot;ps&quot; value=&quot;&quot; /&gt;
</span><del>-                                &lt;input type=&quot;button&quot; onClick=&quot;findPosts.send();&quot; value=&quot;&lt;?php esc_attr_e( 'Search' ); ?&gt;&quot; class=&quot;button&quot; /&gt;&lt;br /&gt;
</del><ins>+                                &lt;input type=&quot;button&quot; onclick=&quot;findPosts.send();&quot; value=&quot;&lt;?php esc_attr_e( 'Search' ); ?&gt;&quot; class=&quot;button&quot; /&gt;&lt;br /&gt;
</ins><span class="cx"> 
</span><span class="cx">                                 &lt;input type=&quot;radio&quot; name=&quot;find-posts-what&quot; id=&quot;find-posts-posts&quot; checked=&quot;checked&quot; value=&quot;posts&quot; /&gt;
</span><span class="cx">                                 &lt;label for=&quot;find-posts-posts&quot;&gt;&lt;?php _e( 'Posts' ); ?&gt;&lt;/label&gt;
</span><span class="lines">@@ -3249,7 +3246,7 @@
</span><span class="cx">                         &lt;div id=&quot;find-posts-response&quot;&gt;&lt;/div&gt;
</span><span class="cx">                 &lt;/div&gt;
</span><span class="cx">                 &lt;div class=&quot;find-box-buttons&quot;&gt;
</span><del>-                        &lt;input type=&quot;button&quot; class=&quot;button alignleft&quot; onClick=&quot;findPosts.close();&quot; value=&quot;&lt;?php esc_attr_e('Close'); ?&gt;&quot; /&gt;
</del><ins>+                        &lt;input type=&quot;button&quot; class=&quot;button alignleft&quot; onclick=&quot;findPosts.close();&quot; value=&quot;&lt;?php esc_attr_e('Close'); ?&gt;&quot; /&gt;
</ins><span class="cx">                         &lt;input id=&quot;find-posts-submit&quot; type=&quot;submit&quot; class=&quot;button-primary alignright&quot; value=&quot;&lt;?php esc_attr_e('Select'); ?&gt;&quot; /&gt;
</span><span class="cx">                 &lt;/div&gt;
</span><span class="cx">         &lt;/div&gt;
</span></span></pre></div>
<a id="trunkwpadminmenuphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/menu.php (12693 => 12694)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/menu.php        2010-01-11 18:53:52 UTC (rev 12693)
+++ trunk/wp-admin/menu.php        2010-01-11 19:27:44 UTC (rev 12694)
</span><span class="lines">@@ -47,15 +47,16 @@
</span><span class="cx"> 
</span><span class="cx">         $i = 15;
</span><span class="cx">         foreach ( $wp_taxonomies as $tax ) {
</span><del>-                if ( $tax-&gt;hierarchical || ! in_array('post', (array) $tax-&gt;object_type, true) )
</del><ins>+                if ( ! in_array('post', (array) $tax-&gt;object_type, true) )
</ins><span class="cx">                         continue;
</span><span class="cx"> 
</span><del>-                $submenu['edit.php'][$i] = array( esc_attr($tax-&gt;label), 'manage_categories', 'edit-tags.php?taxonomy=' . $tax-&gt;name );
</del><ins>+                if ( $tax-&gt;hierarchical )
+                        $submenu['edit.php'][$i] = array( esc_attr($tax-&gt;label), 'manage_categories', 'categories.php?taxonomy=' . $tax-&gt;name );
+                else
+                        $submenu['edit.php'][$i] = array( esc_attr($tax-&gt;label), 'manage_categories', 'edit-tags.php?taxonomy=' . $tax-&gt;name );
</ins><span class="cx">                 ++$i;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        $submenu['edit.php'][50] = array( __('Categories'), 'manage_categories', 'categories.php' );
-
</del><span class="cx"> $menu[10] = array( __('Media'), 'upload_files', 'upload.php', '', 'menu-top', 'menu-media', 'div' );
</span><span class="cx">         $submenu['upload.php'][5] = array( __('Library'), 'upload_files', 'upload.php');
</span><span class="cx">         /* translators: add new file */
</span><span class="lines">@@ -86,10 +87,13 @@
</span><span class="cx"> 
</span><span class="cx">         $i = 15;
</span><span class="cx">         foreach ( $wp_taxonomies as $tax ) {
</span><del>-                if ( $tax-&gt;hierarchical || ! in_array($ptype, (array) $tax-&gt;object_type, true) )
</del><ins>+                if ( ! in_array($ptype, (array) $tax-&gt;object_type, true) )
</ins><span class="cx">                         continue;
</span><span class="cx"> 
</span><del>-                $submenu[&quot;edit.php?post_type=$ptype&quot;][$i] = array( esc_attr($tax-&gt;label), 'manage_categories', &quot;edit-tags.php?taxonomy=$tax-&gt;name&amp;amp;post_type=$ptype&quot; );
</del><ins>+                if ( $tax-&gt;hierarchical )
+                        $submenu[&quot;edit.php?post_type=$ptype&quot;][$i] = array( esc_attr($tax-&gt;label), 'manage_categories', &quot;categories.php?taxonomy=$tax-&gt;name&amp;amp;post_type=$ptype&quot; );
+                else
+                        $submenu[&quot;edit.php?post_type=$ptype&quot;][$i] = array( esc_attr($tax-&gt;label), 'manage_categories', &quot;edit-tags.php?taxonomy=$tax-&gt;name&amp;amp;post_type=$ptype&quot; );
</ins><span class="cx">                 ++$i;
</span><span class="cx">         }
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkwpincludescategorytemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/category-template.php (12693 => 12694)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/category-template.php        2010-01-11 18:53:52 UTC (rev 12693)
+++ trunk/wp-includes/category-template.php        2010-01-11 19:27:44 UTC (rev 12694)
</span><span class="lines">@@ -337,7 +337,8 @@
</span><span class="cx">                 'exclude' =&gt; '', 'echo' =&gt; 1,
</span><span class="cx">                 'selected' =&gt; 0, 'hierarchical' =&gt; 0,
</span><span class="cx">                 'name' =&gt; 'cat', 'class' =&gt; 'postform',
</span><del>-                'depth' =&gt; 0, 'tab_index' =&gt; 0
</del><ins>+                'depth' =&gt; 0, 'tab_index' =&gt; 0,
+                'taxonomy' =&gt; 'category', 'hide_if_empty' =&gt; false
</ins><span class="cx">         );
</span><span class="cx"> 
</span><span class="cx">         $defaults['selected'] = ( is_category() ) ? get_query_var( 'cat' ) : 0;
</span><span class="lines">@@ -359,9 +360,11 @@
</span><span class="cx">         $name = esc_attr($name);
</span><span class="cx">         $class = esc_attr($class);
</span><span class="cx"> 
</span><del>-        $output = '';
</del><ins>+        if ( ! $r['hide_if_empty'] || ! empty($categories) )
+                $output = &quot;&lt;select name='$name' id='$name' class='$class' $tab_index_attribute&gt;\n&quot;;
+        else
+                $output = '';
</ins><span class="cx">         if ( ! empty( $categories ) ) {
</span><del>-                $output = &quot;&lt;select name='$name' id='$name' class='$class' $tab_index_attribute&gt;\n&quot;;
</del><span class="cx"> 
</span><span class="cx">                 if ( $show_option_all ) {
</span><span class="cx">                         $show_option_all = apply_filters( 'list_cats', $show_option_all );
</span><span class="lines">@@ -381,9 +384,11 @@
</span><span class="cx">                         $depth = -1; // Flat.
</span><span class="cx"> 
</span><span class="cx">                 $output .= walk_category_dropdown_tree( $categories, $depth, $r );
</span><ins>+        }
+        if ( ! $r['hide_if_empty'] || ! empty($categories) )
</ins><span class="cx">                 $output .= &quot;&lt;/select&gt;\n&quot;;
</span><del>-        }
</del><span class="cx"> 
</span><ins>+
</ins><span class="cx">         $output = apply_filters( 'wp_dropdown_cats', $output );
</span><span class="cx"> 
</span><span class="cx">         if ( $echo )
</span></span></pre></div>
<a id="trunkwpincludescategoryphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/category.php (12693 => 12694)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/category.php        2010-01-11 18:53:52 UTC (rev 12693)
+++ trunk/wp-includes/category.php        2010-01-11 19:27:44 UTC (rev 12694)
</span><span class="lines">@@ -37,12 +37,14 @@
</span><span class="cx">  * @return array List of categories.
</span><span class="cx">  */
</span><span class="cx"> function &amp;get_categories( $args = '' ) {
</span><del>-        $defaults = array( 'type' =&gt; 'category' );
</del><ins>+        $defaults = array( 'taxonomy' =&gt; 'category' );
</ins><span class="cx">         $args = wp_parse_args( $args, $defaults );
</span><span class="cx"> 
</span><del>-        $taxonomy = apply_filters( 'get_categories_taxonomy', 'category', $args );
-        if ( 'link' == $args['type'] )
-                $taxonomy = 'link_category';
</del><ins>+        $taxonomy = apply_filters( 'get_categories_taxonomy', $args['taxonomy'], $args );
+
+        if ( isset($args['type']) &amp;&amp; 'link' == $args['type'] ) //Back compat
+                $taxonomy = $args['taxonomy'] = 'link_category';
+
</ins><span class="cx">         $categories = (array) get_terms( $taxonomy, $args );
</span><span class="cx"> 
</span><span class="cx">         foreach ( array_keys( $categories ) as $k )
</span></span></pre>
</div>
</div>

</body>
</html>