<!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>[12833] trunk: First scratch at Taxonomy Capabilities.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/12833">12833</a></dd>
<dt>Author</dt> <dd>dd32</dd>
<dt>Date</dt> <dd>2010-01-26 11:32:04 +0000 (Tue, 26 Jan 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>First scratch at Taxonomy Capabilities. See <a href="http://trac.wordpress.org/ticket/12035">#12035</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminadminajaxphp">trunk/wp-admin/admin-ajax.php</a></li>
<li><a href="#trunkwpadmineditformadvancedphp">trunk/wp-admin/edit-form-advanced.php</a></li>
<li><a href="#trunkwpadminedittagsphp">trunk/wp-admin/edit-tags.php</a></li>
<li><a href="#trunkwpadminincludesmetaboxesphp">trunk/wp-admin/includes/meta-boxes.php</a></li>
<li><a href="#trunkwpadminincludestemplatephp">trunk/wp-admin/includes/template.php</a></li>
<li><a href="#trunkwpincludestaxonomyphp">trunk/wp-includes/taxonomy.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminadminajaxphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/admin-ajax.php (12832 => 12833)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/admin-ajax.php        2010-01-26 06:53:47 UTC (rev 12832)
+++ trunk/wp-admin/admin-ajax.php        2010-01-26 11:32:04 UTC (rev 12833)
</span><span class="lines">@@ -204,7 +204,7 @@
</span><span class="cx">         $action = $_POST['action'];
</span><span class="cx">         $taxonomy = get_taxonomy(substr($action, 4));
</span><span class="cx">         check_ajax_referer( $action );
</span><del>-        if ( !current_user_can( 'manage_categories' ) )
</del><ins>+        if ( !current_user_can( $taxonomy->manage_cap ) )
</ins><span class="cx">                 die('-1');
</span><span class="cx">         $names = explode(',', $_POST['new'.$taxonomy->name]);
</span><span class="cx">         $parent = isset($_POST['new'.$taxonomy->name.'_parent']) ? (int) $_POST['new'.$taxonomy->name.'_parent'] : 0;
</span><span class="lines">@@ -329,11 +329,13 @@
</span><span class="cx"> case 'delete-tag' :
</span><span class="cx">         $tag_id = (int) $_POST['tag_ID'];
</span><span class="cx">         check_ajax_referer( "delete-tag_$tag_id" );
</span><del>-        if ( !current_user_can( 'manage_categories' ) )
-                die('-1');
</del><span class="cx">
</span><span class="cx">         $taxonomy = !empty($_POST['taxonomy']) ? $_POST['taxonomy'] : 'post_tag';
</span><ins>+        $tax = get_taxonomy($taxonomy);
</ins><span class="cx">
</span><ins>+        if ( !current_user_can( $tax->delete_cap ) )
+                die('-1');
+
</ins><span class="cx">         $tag = get_term( $tag_id, $taxonomy );
</span><span class="cx">         if ( !$tag || is_wp_error( $tag ) )
</span><span class="cx">                 die('1');
</span><span class="lines">@@ -599,10 +601,13 @@
</span><span class="cx">         break;
</span><span class="cx"> case 'add-tag' : // From Manage->Tags
</span><span class="cx">         check_ajax_referer( 'add-tag' );
</span><del>-        if ( !current_user_can( 'manage_categories' ) )
</del><ins>+
+        $taxonomy = !empty($_POST['taxonomy']) ? $_POST['taxonomy'] : 'post_tag';
+        $tax = get_taxonomy($taxonomy);
+
+        if ( !current_user_can( $tax->edit_cap ) )
</ins><span class="cx">                 die('-1');
</span><span class="cx">
</span><del>-        $taxonomy = !empty($_POST['taxonomy']) ? $_POST['taxonomy'] : 'post_tag';
</del><span class="cx">         $tag = wp_insert_term($_POST['tag-name'], $taxonomy, $_POST );
</span><span class="cx">
</span><span class="cx">         if ( !$tag || is_wp_error($tag) || (!$tag = get_term( $tag['term_id'], $taxonomy )) ) {
</span><span class="lines">@@ -1175,8 +1180,13 @@
</span><span class="cx"> case 'inline-save-tax':
</span><span class="cx">         check_ajax_referer( 'taxinlineeditnonce', '_inline_edit' );
</span><span class="cx">
</span><del>-        if ( ! current_user_can('manage_categories') )
</del><ins>+        $taxonomy = !empty($_POST['taxonomy']) ? $_POST['taxonomy'] : false;
+        if ( ! $taxonomy )
</ins><span class="cx">                 die( __('Cheatin&#8217; uh?') );
</span><ins>+        $tax = get_taxonomy($taxonomy);
+                
+        if ( ! current_user_can( $tax->edit_cap ) )
+                die( __('Cheatin&#8217; uh?') );
</ins><span class="cx">
</span><span class="cx">         if ( ! isset($_POST['tax_ID']) || ! ( $id = (int) $_POST['tax_ID'] ) )
</span><span class="cx">                 die(-1);
</span></span></pre></div>
<a id="trunkwpadmineditformadvancedphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/edit-form-advanced.php (12832 => 12833)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/edit-form-advanced.php        2010-01-26 06:53:47 UTC (rev 12832)
+++ trunk/wp-admin/edit-form-advanced.php        2010-01-26 11:32:04 UTC (rev 12833)
</span><span class="lines">@@ -97,10 +97,13 @@
</span><span class="cx">         $taxonomy = get_taxonomy($tax_name);
</span><span class="cx">         $label = isset($taxonomy->label) ? esc_attr($taxonomy->label) : $tax_name;
</span><span class="cx">
</span><ins>+        if ( !current_user_can($taxonomy->manage_cap) )
+                continue;
+
</ins><span class="cx">         if ( !is_taxonomy_hierarchical($tax_name) )
</span><span class="cx">                 add_meta_box('tagsdiv-' . $tax_name, $label, 'post_tags_meta_box', $post_type, 'side', 'core');
</span><span class="cx">         else
</span><del>-                add_meta_box($tax_name.'div', $label, 'post_categories_meta_box', 'post', 'side', 'core', array( 'taxonomy' => $tax_name ));
</del><ins>+                add_meta_box($tax_name . 'div', $label, 'post_categories_meta_box', 'post', 'side', 'core', array( 'taxonomy' => $tax_name ));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if ( post_type_supports($post_type, 'page-attributes') )
</span></span></pre></div>
<a id="trunkwpadminedittagsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/edit-tags.php (12832 => 12833)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/edit-tags.php        2010-01-26 06:53:47 UTC (rev 12832)
+++ trunk/wp-admin/edit-tags.php        2010-01-26 11:32:04 UTC (rev 12833)
</span><span class="lines">@@ -19,6 +19,8 @@
</span><span class="cx"> if ( !is_taxonomy($taxonomy) )
</span><span class="cx">         wp_die(__('Invalid taxonomy'));
</span><span class="cx">
</span><ins>+$tax = get_taxonomy($taxonomy);
+
</ins><span class="cx"> if ( empty($post_type) || !in_array( $post_type, get_post_types( array('_show' => true) ) ) )
</span><span class="cx">         $post_type = 'post';
</span><span class="cx">
</span><span class="lines">@@ -39,7 +41,7 @@
</span><span class="cx">
</span><span class="cx">         check_admin_referer('add-tag');
</span><span class="cx">
</span><del>-        if ( !current_user_can('manage_categories') )
</del><ins>+        if ( !current_user_can($tax->edit_cap) )
</ins><span class="cx">                 wp_die(__('Cheatin&#8217; uh?'));
</span><span class="cx">
</span><span class="cx">         $ret = wp_insert_term($_POST['tag-name'], $taxonomy, $_POST);
</span><span class="lines">@@ -60,7 +62,7 @@
</span><span class="cx">         $tag_ID = (int) $_GET['tag_ID'];
</span><span class="cx">         check_admin_referer('delete-tag_' . $tag_ID);
</span><span class="cx">
</span><del>-        if ( !current_user_can('manage_categories') )
</del><ins>+        if ( !current_user_can($tax->delete_cap) )
</ins><span class="cx">                 wp_die(__('Cheatin&#8217; uh?'));
</span><span class="cx">
</span><span class="cx">         wp_delete_term( $tag_ID, $taxonomy);
</span><span class="lines">@@ -80,7 +82,7 @@
</span><span class="cx"> case 'bulk-delete':
</span><span class="cx">         check_admin_referer('bulk-tags');
</span><span class="cx">
</span><del>-        if ( !current_user_can('manage_categories') )
</del><ins>+        if ( !current_user_can($tax->delete_cap) )
</ins><span class="cx">                 wp_die(__('Cheatin&#8217; uh?'));
</span><span class="cx">
</span><span class="cx">         $tags = (array) $_GET['delete_tags'];
</span><span class="lines">@@ -115,7 +117,7 @@
</span><span class="cx">         $tag_ID = (int) $_POST['tag_ID'];
</span><span class="cx">         check_admin_referer('update-tag_' . $tag_ID);
</span><span class="cx">
</span><del>-        if ( !current_user_can('manage_categories') )
</del><ins>+        if ( !current_user_can($tax->edit_cap) )
</ins><span class="cx">                 wp_die(__('Cheatin&#8217; uh?'));
</span><span class="cx">
</span><span class="cx">         $ret = wp_update_term($tag_ID, $taxonomy, $_POST);
</span><span class="lines">@@ -142,10 +144,8 @@
</span><span class="cx">          exit;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-$can_manage = current_user_can('manage_categories');
-
</del><span class="cx"> wp_enqueue_script('admin-tags');
</span><del>-if ( $can_manage )
</del><ins>+if ( current_user_can($tax->edit_cap) )
</ins><span class="cx">         wp_enqueue_script('inline-edit-tax');
</span><span class="cx">
</span><span class="cx"> require_once ('admin-header.php');
</span><span class="lines">@@ -249,10 +249,7 @@
</span><span class="cx">         </tfoot>
</span><span class="cx">
</span><span class="cx">         <tbody id="the-list" class="list:tag">
</span><del>-<?php
-
-$count = tag_rows( $pagenum, $tags_per_page, $searchterms, $taxonomy );
-?>
</del><ins>+<?php tag_rows( $pagenum, $tags_per_page, $searchterms, $taxonomy ); ?>
</ins><span class="cx">         </tbody>
</span><span class="cx"> </table>
</span><span class="cx">
</span><span class="lines">@@ -284,15 +281,15 @@
</span><span class="cx"> <div class="tagcloud">
</span><span class="cx"> <h3><?php _e('Popular Tags'); ?></h3>
</span><span class="cx"> <?php
</span><del>-if ( $can_manage )
</del><ins>+if ( current_user_can($tax->edit_cap) )
</ins><span class="cx">         wp_tag_cloud(array('taxonomy' => $taxonomy, 'link' => 'edit'));
</span><span class="cx"> else
</span><span class="cx">         wp_tag_cloud(array('taxonomy' => $taxonomy));
</span><span class="cx"> ?>
</span><span class="cx"> </div>
</span><span class="cx">
</span><del>-<?php if ( $can_manage ) {
-        do_action('add_tag_form_pre'); ?>
</del><ins>+<?php if ( current_user_can($tax->edit_cap) ) {
+        do_action('add_tag_form_pre', $taxonomy); ?>
</ins><span class="cx">
</span><span class="cx"> <div class="form-wrap">
</span><span class="cx"> <h3><?php _e('Add a New Tag'); ?></h3>
</span><span class="lines">@@ -327,7 +324,7 @@
</span><span class="cx"> </div>
</span><span class="cx">
</span><span class="cx"> <p class="submit"><input type="submit" class="button" name="submit" id="submit" value="<?php esc_attr_e('Add Tag'); ?>" /></p>
</span><del>-<?php do_action('add_tag_form'); ?>
</del><ins>+<?php do_action('add_tag_form', $taxonomy); ?>
</ins><span class="cx"> </form></div>
</span><span class="cx"> <?php } ?>
</span><span class="cx">
</span></span></pre></div>
<a id="trunkwpadminincludesmetaboxesphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/meta-boxes.php (12832 => 12833)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/meta-boxes.php        2010-01-26 06:53:47 UTC (rev 12832)
+++ trunk/wp-admin/includes/meta-boxes.php        2010-01-26 11:32:04 UTC (rev 12833)
</span><span class="lines">@@ -239,6 +239,8 @@
</span><span class="cx"> function post_tags_meta_box($post, $box) {
</span><span class="cx">         $tax_name = esc_attr(substr($box['id'], 8));
</span><span class="cx">         $taxonomy = get_taxonomy($tax_name);
</span><ins>+        if ( !current_user_can($taxonomy->manage_cap) )
+                return;
</ins><span class="cx">         $helps = isset($taxonomy->helps) ? esc_attr($taxonomy->helps) : __('Separate tags with commas.');
</span><span class="cx"> ?>
</span><span class="cx"> <div class="tagsdiv" id="<?php echo $tax_name; ?>">
</span><span class="lines">@@ -275,6 +277,10 @@
</span><span class="cx">         else
</span><span class="cx">                 $args = $box['args'];
</span><span class="cx">         extract( wp_parse_args($args, $defaults), EXTR_SKIP );
</span><ins>+        $tax = get_taxonomy($taxonomy);
+
+        if ( !current_user_can($tax->manage_cap) )
+                return;
</ins><span class="cx">         ?>
</span><span class="cx">         <div id="taxonomy-<?php echo $taxonomy; ?>" class="categorydiv">
</span><span class="cx">                 <ul id="<?php echo $taxonomy; ?>-tabs" class="category-tabs">
</span><span class="lines">@@ -294,7 +300,7 @@
</span><span class="cx">                         </ul>
</span><span class="cx">                 </div>
</span><span class="cx">
</span><del>- <?php if ( current_user_can('manage_categories') ) : ?>
</del><ins>+ <?php if ( current_user_can($tax->edit_cap) ) : ?>
</ins><span class="cx">                         <div id="<?php echo $taxonomy; ?>-adder" class="wp-hidden-children">
</span><span class="cx">                                 <h4><a id="<?php echo $taxonomy; ?>-add-toggle" href="#<?php echo $taxonomy; ?>-add" class="hide-if-no-js" tabindex="3"><?php _e( '+ Add New Category' ); ?></a></h4>
</span><span class="cx">                                 <p id="<?php echo $taxonomy; ?>-add" class="category-add wp-hidden-child">
</span></span></pre></div>
<a id="trunkwpadminincludestemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/template.php (12832 => 12833)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/template.php        2010-01-26 06:53:47 UTC (rev 12832)
+++ trunk/wp-admin/includes/template.php        2010-01-26 11:32:04 UTC (rev 12833)
</span><span class="lines">@@ -211,7 +211,8 @@
</span><span class="cx"> */
</span><span class="cx"> function inline_edit_term_row($type, $taxonomy) {
</span><span class="cx">
</span><del>-        if ( ! current_user_can( 'manage_categories' ) )
</del><ins>+        $tax = get_taxonomy($taxonomy);
+        if ( ! current_user_can( $tax->edit_cap ) )
</ins><span class="cx">                 return;
</span><span class="cx">
</span><span class="cx">         $columns = get_column_headers($type);
</span><span class="lines">@@ -678,16 +679,22 @@
</span><span class="cx">                         $tagsel = 'category_name';
</span><span class="cx">                 else
</span><span class="cx">                         $tagsel = $taxonomy;
</span><ins>+
+                $tax = get_taxonomy($taxonomy);
+
</ins><span class="cx">                 $count = ( $count > 0 ) ? "<a href='edit.php?$tagsel=$tag->slug'>$count</a>" : $count;
</span><span class="cx">
</span><span class="cx">                 $pad = str_repeat( '&#8212; ', max(0, $level) );
</span><span class="cx">                 $name = apply_filters( 'term_name', $pad . ' ' . $tag->name );
</span><span class="cx">                 $qe_data = get_term($tag->term_id, $taxonomy, object, 'edit');
</span><span class="cx">                 $edit_link = "edit-tags.php?action=edit&amp;taxonomy=$taxonomy&amp;tag_ID=$tag->term_id";
</span><ins>+
</ins><span class="cx">                 $out = '';
</span><span class="cx">                 $out .= '<tr id="tag-' . $tag->term_id . '"' . $class . '>';
</span><ins>+
</ins><span class="cx">                 $columns = get_column_headers('edit-tags');
</span><span class="cx">                 $hidden = get_hidden_columns('edit-tags');
</span><ins>+                $default_term = get_option('default_' . $taxonomy);
</ins><span class="cx">                 foreach ( $columns as $column_name => $column_display_name ) {
</span><span class="cx">                         $class = "class=\"$column_name column-$column_name\"";
</span><span class="cx">
</span><span class="lines">@@ -699,7 +706,7 @@
</span><span class="cx">
</span><span class="cx">                         switch ($column_name) {
</span><span class="cx">                                 case 'cb':
</span><del>-                                        if ( $tag->term_id != get_option('default_' . $taxonomy) )
</del><ins>+                                        if ( current_user_can($tax->delete_cap) && $tag->term_id != $default_term )
</ins><span class="cx">                                                 $out .= '<th scope="row" class="check-column"> <input type="checkbox" name="delete_tags[]" value="' . $tag->term_id . '" /></th>';
</span><span class="cx">                                         else
</span><span class="cx">                                                 $out .= '<th scope="row" class="check-column">&nbsp;</th>';
</span><span class="lines">@@ -707,9 +714,11 @@
</span><span class="cx">                                 case 'name':
</span><span class="cx">                                         $out .= '<td ' . $attributes . '><strong><a class="row-title" href="' . $edit_link . '" title="' . esc_attr(sprintf(__('Edit &#8220;%s&#8221;'), $name)) . '">' . $name . '</a></strong><br />';
</span><span class="cx">                                         $actions = array();
</span><del>-                                        $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
-                                        $actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __('Quick&nbsp;Edit') . '</a>';
-                                        if ( $tag->term_id != get_option('default_' . $taxonomy) )
</del><ins>+                                        if ( current_user_can($tax->edit_cap) ) {
+                                                $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
+                                                $actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __('Quick&nbsp;Edit') . '</a>';
+                                        }
+                                        if ( current_user_can($tax->delete_cap) && $tag->term_id != $default_term )
</ins><span class="cx">                                                 $actions['delete'] = "<a class='delete-tag' href='" . wp_nonce_url("edit-tags.php?action=delete&amp;taxonomy=$taxonomy&amp;tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id) . "'>" . __('Delete') . "</a>";
</span><span class="cx">
</span><span class="cx">                                         $actions = apply_filters('tag_row_actions', $actions, $tag);
</span><span class="lines">@@ -746,7 +755,7 @@
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx">
</span><del>-                $out .= '</tr>';
</del><ins>+                $out .= "</tr>\n";
</ins><span class="cx">
</span><span class="cx">                 return $out;
</span><span class="cx"> }
</span><span class="lines">@@ -795,7 +804,6 @@
</span><span class="cx">                         $out .= _tag_row( $term, 0, ++$count % 2 ? ' class="alternate"' : '', $taxonomy );
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        // filter and send to screen
</del><span class="cx">         echo $out;
</span><span class="cx">         return $count;
</span><span class="cx"> }
</span><span class="lines">@@ -1135,7 +1143,7 @@
</span><span class="cx">         ?>" style="display: none"><td colspan="<?php echo $col_count; ?>">
</span><span class="cx">
</span><span class="cx">         <fieldset class="inline-edit-col-left"><div class="inline-edit-col">
</span><del>-                <h4><?php echo $bulk ? ( __( 'Bulk Edit' ) ) : __( 'Quick Edit' ); ?></h4>
</del><ins>+                <h4><?php echo $bulk ? __( 'Bulk Edit' ) : __( 'Quick Edit' ); ?></h4>
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> <?php if ( $bulk ) : ?>
</span></span></pre></div>
<a id="trunkwpincludestaxonomyphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/taxonomy.php (12832 => 12833)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/taxonomy.php        2010-01-26 06:53:47 UTC (rev 12832)
+++ trunk/wp-includes/taxonomy.php        2010-01-26 11:32:04 UTC (rev 12833)
</span><span class="lines">@@ -15,9 +15,27 @@
</span><span class="cx"> * Creates the initial taxonomies when 'init' action is fired.
</span><span class="cx"> */
</span><span class="cx"> function create_initial_taxonomies() {
</span><del>-        register_taxonomy( 'category', 'post', array('hierarchical' => true, 'update_count_callback' => '_update_post_term_count', 'label' => __('Categories'), 'query_var' => false, 'rewrite' => false) ) ;
-        register_taxonomy( 'post_tag', 'post', array('hierarchical' => false, 'update_count_callback' => '_update_post_term_count', 'label' => __('Post Tags'), 'query_var' => false, 'rewrite' => false) ) ;
-        register_taxonomy( 'link_category', 'link', array('hierarchical' => false, 'label' => __('Categories'), 'query_var' => false, 'rewrite' => false) ) ;
</del><ins>+        register_taxonomy( 'category', 'post', array(        'hierarchical' => true,
+                                                                                                         'update_count_callback' => '_update_post_term_count',
+                                                                                                        'label' => __('Categories'),
+                                                                                                        'query_var' => false,
+                                                                                                        'rewrite' => false,
+                                                                                                        'edit_cap' => 'no_priv'
+                                                                                                ) ) ;
+
+        register_taxonomy( 'post_tag', 'post', array(
+                                                                                                         'hierarchical' => false,
+                                                                                                        'update_count_callback' => '_update_post_term_count',
+                                                                                                        'label' => __('Post Tags'),
+                                                                                                        'query_var' => false,
+                                                                                                        'rewrite' => false
+                                                                                                ) ) ;
+
+        register_taxonomy( 'link_category', 'link', array(        'hierarchical' => false,
+                                                                                                                 'label' => __('Categories'),
+                                                                                                                'query_var' => false,
+                                                                                                                'rewrite' => false
+                                                                                                        ) ) ;
</ins><span class="cx"> }
</span><span class="cx"> add_action( 'init', 'create_initial_taxonomies', 0 ); // highest priority
</span><span class="cx">
</span><span class="lines">@@ -167,7 +185,7 @@
</span><span class="cx"> function register_taxonomy( $taxonomy, $object_type, $args = array() ) {
</span><span class="cx">         global $wp_taxonomies, $wp_rewrite, $wp;
</span><span class="cx">
</span><del>-        if (!is_array($wp_taxonomies))
</del><ins>+        if ( ! is_array($wp_taxonomies) )
</ins><span class="cx">                 $wp_taxonomies = array();
</span><span class="cx">
</span><span class="cx">         $defaults = array('hierarchical' => false, 'update_count_callback' => '', 'rewrite' => true, 'query_var' => true);
</span><span class="lines">@@ -191,6 +209,11 @@
</span><span class="cx">                 $wp_rewrite->add_permastruct($taxonomy, "/{$args['rewrite']['slug']}/%$taxonomy%", $args['rewrite']['with_front']);
</span><span class="cx">         }
</span><span class="cx">
</span><ins>+        foreach ( array('manage_cap', 'edit_cap', 'delete_cap') as $cap ) {
+                if ( empty($args[$cap]) )
+                        $args[$cap] = 'manage_categories';
+        }
+
</ins><span class="cx">         $args['name'] = $taxonomy;
</span><span class="cx">         $args['object_type'] = (array) $object_type;
</span><span class="cx">         $wp_taxonomies[$taxonomy] = (object) $args;
</span></span></pre>
</div>
</div>
</body>
</html>