<!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" />
<title>[25130] trunk/src/wp-includes: Improve inline docs for register_post_type() and register_taxonomy().</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { 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 #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#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>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/25130">25130</a></dd>
<dt>Author</dt> <dd>ocean90</dd>
<dt>Date</dt> <dd>2013-08-26 20:23:34 +0000 (Mon, 26 Aug 2013)</dd>
</dl>

<h3>Log Message</h3>
<pre>Improve inline docs for register_post_type() and register_taxonomy().

* register_taxonomy: Use the same doc format for the associative array arg as used for register_post_type()
* register_taxonomy: Improve docs for _builtin, capabilities, hierarchical and rewrite args
* register_taxonomy: Use the same order in $defaults as in docblock
* register_taxonomy: Replace is_null with null ===, to be consistent
* register_post_type: Use the same order in $defaults as in docblock
* register_post_type: Improve docs for @uses and default fallbacks
And while we're on it: Whitespaces.

fixes <a href="http://core.trac.wordpress.org/ticket/25150">#25150</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludespostphp">trunk/src/wp-includes/post.php</a></li>
<li><a href="#trunksrcwpincludestaxonomyphp">trunk/src/wp-includes/taxonomy.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludespostphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/post.php (25129 => 25130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/post.php   2013-08-26 19:28:50 UTC (rev 25129)
+++ trunk/src/wp-includes/post.php      2013-08-26 20:23:34 UTC (rev 25130)
</span><span class="lines">@@ -1102,6 +1102,7 @@
</span><span class="cx">  *     * Defaults to false.
</span><span class="cx">  *     * While the default settings of exclude_from_search, publicly_queryable, show_ui, and show_in_nav_menus are
</span><span class="cx">  *       inherited from public, each does not rely on this relationship and controls a very specific intention.
</span><ins>+ * - hierarchical - Whether the post type is hierarchical (e.g. page). Defaults to false.
</ins><span class="cx">  * - exclude_from_search - Whether to exclude posts with this post type from front end search results.
</span><span class="cx">  *     * If not set, the opposite of public's current value is used.
</span><span class="cx">  * - publicly_queryable - Whether queries can be performed on the front end for the post type as part of parse_request().
</span><span class="lines">@@ -1111,8 +1112,6 @@
</span><span class="cx">  *     * If not set, the default is inherited from public.
</span><span class="cx">  * - show_ui - Whether to generate a default UI for managing this post type in the admin.
</span><span class="cx">  *     * If not set, the default is inherited from public.
</span><del>- * - show_in_nav_menus - Makes this post type available for selection in navigation menus.
- *     * If not set, the default is inherited from public.
</del><span class="cx">  * - show_in_menu - Where to show the post type in the admin menu.
</span><span class="cx">  *     * If true, the post type is shown in its own top level menu.
</span><span class="cx">  *     * If false, no menu is shown
</span><span class="lines">@@ -1120,6 +1119,8 @@
</span><span class="cx">  *       be placed as a sub menu of that.
</span><span class="cx">  *     * show_ui must be true.
</span><span class="cx">  *     * If not set, the default is inherited from show_ui
</span><ins>+ * - show_in_nav_menus - Makes this post type available for selection in navigation menus.
+ *     * If not set, the default is inherited from public.
</ins><span class="cx">  * - show_in_admin_bar - Makes this post type available via the admin bar.
</span><span class="cx">  *     * If not set, the default is inherited from show_in_menu
</span><span class="cx">  * - menu_position - The position in the menu order the post type should appear.
</span><span class="lines">@@ -1133,7 +1134,6 @@
</span><span class="cx">  *     * By default the capability_type is used as a base to construct capabilities.
</span><span class="cx">  *     * You can see accepted values in {@link get_post_type_capabilities()}.
</span><span class="cx">  * - map_meta_cap - Whether to use the internal default meta capability handling. Defaults to false.
</span><del>- * - hierarchical - Whether the post type is hierarchical (e.g. page). Defaults to false.
</del><span class="cx">  * - supports - An alias for calling add_post_type_support() directly. Defaults to title and editor.
</span><span class="cx">  *     * See {@link add_post_type_support()} for documentation.
</span><span class="cx">  * - register_meta_box_cb - Provide a callback function that will be called when setting up the
</span><span class="lines">@@ -1166,37 +1166,55 @@
</span><span class="cx">  *
</span><span class="cx">  * @since 2.9.0
</span><span class="cx">  * @uses $wp_post_types Inserts new post type object into the list
</span><ins>+ * @uses $wp_rewrite Gets default feeds
+ * @uses $wp Adds query vars
</ins><span class="cx">  *
</span><del>- * @param string $post_type Post type key, must not exceed 20 characters
</del><ins>+ * @param string $post_type Post type key, must not exceed 20 characters.
</ins><span class="cx">  * @param array|string $args See optional args description above.
</span><del>- * @return object|WP_Error the registered post type object, or an error object
</del><ins>+ * @return object|WP_Error the registered post type object, or an error object.
</ins><span class="cx">  */
</span><span class="cx"> function register_post_type( $post_type, $args = array() ) {
</span><span class="cx">  global $wp_post_types, $wp_rewrite, $wp;
</span><span class="cx"> 
</span><del>-       if ( !is_array($wp_post_types) )
</del><ins>+        if ( ! is_array( $wp_post_types ) )
</ins><span class="cx">           $wp_post_types = array();
</span><span class="cx"> 
</span><span class="cx">  // Args prefixed with an underscore are reserved for internal use.
</span><span class="cx">  $defaults = array(
</span><del>-               'labels' => array(), 'description' => '', 'publicly_queryable' => null, 'exclude_from_search' => null,
-               'capability_type' => 'post', 'capabilities' => array(), 'map_meta_cap' => null,
-               '_builtin' => false, '_edit_link' => 'post.php?post=%d', 'hierarchical' => false,
-               'public' => false, 'rewrite' => true, 'has_archive' => false, 'query_var' => true,
-               'supports' => array(), 'register_meta_box_cb' => null,
-               'taxonomies' => array(), 'show_ui' => null, 'menu_position' => null, 'menu_icon' => null,
-               'can_export' => true,
-               'show_in_nav_menus' => null, 'show_in_menu' => null, 'show_in_admin_bar' => null,
-               'delete_with_user' => null,
</del><ins>+                'labels'               => array(),
+               'description'          => '',
+               'public'               => false,
+               'hierarchical'         => false,
+               'exclude_from_search'  => null,
+               'publicly_queryable'   => null,
+               'show_ui'              => null,
+               'show_in_menu'         => null,
+               'show_in_nav_menus'    => null,
+               'show_in_admin_bar'    => null,
+               'menu_position'        => null,
+               'menu_icon'            => null,
+               'capability_type'      => 'post',
+               'capabilities'         => array(),
+               'map_meta_cap'         => null,
+               'supports'             => array(),
+               'register_meta_box_cb' => null,
+               'taxonomies'           => array(),
+               'has_archive'          => false,
+               'rewrite'              => true,
+               'query_var'            => true,
+               'can_export'           => true,
+               'delete_with_user'     => null,
+               '_builtin'             => false,
+               '_edit_link'           => 'post.php?post=%d',
</ins><span class="cx">   );
</span><del>-       $args = wp_parse_args($args, $defaults);
</del><ins>+        $args = wp_parse_args( $args, $defaults );
</ins><span class="cx">   $args = (object) $args;
</span><span class="cx"> 
</span><del>-       $post_type = sanitize_key($post_type);
</del><ins>+        $post_type = sanitize_key( $post_type );
</ins><span class="cx">   $args->name = $post_type;
</span><span class="cx"> 
</span><span class="cx">  if ( strlen( $post_type ) > 20 )
</span><del>-                       return new WP_Error( 'post_type_too_long', __( 'Post types cannot exceed 20 characters in length' ) );
</del><ins>+                return new WP_Error( 'post_type_too_long', __( 'Post types cannot exceed 20 characters in length' ) );
</ins><span class="cx"> 
</span><span class="cx">  // If not set, default to the setting for public.
</span><span class="cx">  if ( null === $args->publicly_queryable )
</span><span class="lines">@@ -1214,7 +1232,7 @@
</span><span class="cx">  if ( null === $args->show_in_admin_bar )
</span><span class="cx">          $args->show_in_admin_bar = true === $args->show_in_menu;
</span><span class="cx"> 
</span><del>-       // Whether to show this type in nav-menus.php. Defaults to the setting for public.
</del><ins>+        // If not set, default to the setting for public.
</ins><span class="cx">   if ( null === $args->show_in_nav_menus )
</span><span class="cx">          $args->show_in_nav_menus = $args->public;
</span><span class="cx"> 
</span><span class="lines">@@ -1226,32 +1244,33 @@
</span><span class="cx">  if ( empty( $args->capabilities ) && null === $args->map_meta_cap && in_array( $args->capability_type, array( 'post', 'page' ) ) )
</span><span class="cx">          $args->map_meta_cap = true;
</span><span class="cx"> 
</span><ins>+       // If not set, default to false.
</ins><span class="cx">   if ( null === $args->map_meta_cap )
</span><span class="cx">          $args->map_meta_cap = false;
</span><span class="cx"> 
</span><span class="cx">  $args->cap = get_post_type_capabilities( $args );
</span><del>-       unset($args->capabilities);
</del><ins>+        unset( $args->capabilities );
</ins><span class="cx"> 
</span><span class="cx">  if ( is_array( $args->capability_type ) )
</span><span class="cx">          $args->capability_type = $args->capability_type[0];
</span><span class="cx"> 
</span><del>-       if ( ! empty($args->supports) ) {
-               add_post_type_support($post_type, $args->supports);
-               unset($args->supports);
</del><ins>+        if ( ! empty( $args->supports ) ) {
+               add_post_type_support( $post_type, $args->supports );
+               unset( $args->supports );
</ins><span class="cx">   } elseif ( false !== $args->supports ) {
</span><span class="cx">          // Add default features
</span><del>-               add_post_type_support($post_type, array('title', 'editor'));
</del><ins>+                add_post_type_support( $post_type, array( 'title', 'editor' ) );
</ins><span class="cx">   }
</span><span class="cx"> 
</span><del>-       if ( false !== $args->query_var && !empty($wp) ) {
</del><ins>+        if ( false !== $args->query_var && ! empty( $wp ) ) {
</ins><span class="cx">           if ( true === $args->query_var )
</span><span class="cx">                  $args->query_var = $post_type;
</span><span class="cx">          else
</span><del>-                       $args->query_var = sanitize_title_with_dashes($args->query_var);
-               $wp->add_query_var($args->query_var);
</del><ins>+                        $args->query_var = sanitize_title_with_dashes( $args->query_var );
+               $wp->add_query_var( $args->query_var );
</ins><span class="cx">   }
</span><span class="cx"> 
</span><del>-       if ( false !== $args->rewrite && ( is_admin() || '' != get_option('permalink_structure') ) ) {
</del><ins>+        if ( false !== $args->rewrite && ( is_admin() || '' != get_option( 'permalink_structure' ) ) ) {
</ins><span class="cx">           if ( ! is_array( $args->rewrite ) )
</span><span class="cx">                  $args->rewrite = array();
</span><span class="cx">          if ( empty( $args->rewrite['slug'] ) )
</span><span class="lines">@@ -1270,9 +1289,9 @@
</span><span class="cx">          }
</span><span class="cx"> 
</span><span class="cx">          if ( $args->hierarchical )
</span><del>-                       add_rewrite_tag("%$post_type%", '(.+?)', $args->query_var ? "{$args->query_var}=" : "post_type=$post_type&name=");
</del><ins>+                        add_rewrite_tag( "%$post_type%", '(.+?)', $args->query_var ? "{$args->query_var}=" : "post_type=$post_type&name=" );
</ins><span class="cx">           else
</span><del>-                       add_rewrite_tag("%$post_type%", '([^/]+)', $args->query_var ? "{$args->query_var}=" : "post_type=$post_type&name=");
</del><ins>+                        add_rewrite_tag( "%$post_type%", '([^/]+)', $args->query_var ? "{$args->query_var}=" : "post_type=$post_type&name=" );
</ins><span class="cx"> 
</span><span class="cx">          if ( $args->has_archive ) {
</span><span class="cx">                  $archive_slug = $args->has_archive === true ? $args->rewrite['slug'] : $args->has_archive;
</span><span class="lines">@@ -1297,12 +1316,12 @@
</span><span class="cx">  }
</span><span class="cx"> 
</span><span class="cx">  if ( $args->register_meta_box_cb )
</span><del>-               add_action('add_meta_boxes_' . $post_type, $args->register_meta_box_cb, 10, 1);
</del><ins>+                add_action( 'add_meta_boxes_' . $post_type, $args->register_meta_box_cb, 10, 1 );
</ins><span class="cx"> 
</span><span class="cx">  $args->labels = get_post_type_labels( $args );
</span><span class="cx">  $args->label = $args->labels->name;
</span><span class="cx"> 
</span><del>-       $wp_post_types[$post_type] = $args;
</del><ins>+        $wp_post_types[ $post_type ] = $args;
</ins><span class="cx"> 
</span><span class="cx">  add_action( 'future_' . $post_type, '_future_post_hook', 5, 2 );
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunksrcwpincludestaxonomyphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/taxonomy.php (25129 => 25130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/taxonomy.php       2013-08-26 19:28:50 UTC (rev 25129)
+++ trunk/src/wp-includes/taxonomy.php  2013-08-26 20:23:34 UTC (rev 25130)
</span><span class="lines">@@ -270,89 +270,88 @@
</span><span class="cx">  *
</span><span class="cx">  * Optional $args contents:
</span><span class="cx">  *
</span><del>- * label - Name of the taxonomy shown in the menu. Usually plural. If not set, labels['name'] will be used.
</del><ins>+ * - label - Name of the taxonomy shown in the menu. Usually plural. If not set, labels['name'] will be used.
+ * - labels - An array of labels for this taxonomy.
+ *     * By default tag labels are used for non-hierarchical types and category labels for hierarchical ones.
+ *     * You can see accepted values in {@link get_taxonomy_labels()}.
+ * - description - A short descriptive summary of what the taxonomy is for. Defaults to blank.
+ * - public - If the taxonomy should be publicly queryable; //@TODO not implemented.
+ *     * Defaults to true.
+ * - hierarchical - Whether the taxonomy is hierarchical (e.g. category). Defaults to false.
+ * - show_ui -Whether to generate a default UI for managing this taxonomy in the admin.
+ *     * If not set, the default is inherited from public.
+ * - show_in_nav_menus - Makes this taxonomy available for selection in navigation menus.
+ *     * If not set, the default is inherited from public.
+ * - show_tagcloud - Whether to list the taxonomy in the Tag Cloud Widget.
+ *     * If not set, the default is inherited from show_ui.
+ * - capabilities - Array of capabilities for this taxonomy.
+ *     * You can see accepted values in this function.
+ * - rewrite - Triggers the handling of rewrites for this taxonomy. Defaults to true, using $taxonomy as slug.
+ *     * To prevent rewrite, set to false.
+ *     * To specify rewrite rules, an array can be passed with any of these keys
+ *         * 'slug' => string Customize the permastruct slug. Defaults to $taxonomy key
+ *         * 'with_front' => bool Should the permastruct be prepended with WP_Rewrite::$front. Defaults to true.
+ *         * 'hierarchical' => bool Either hierarchical rewrite tag or not. Defaults to false.
+ *         * 'ep_mask' => const Assign an endpoint mask.
+ *             * If not specified, defaults to EP_NONE.
+ * - query_var - Sets the query_var key for this taxonomy. Defaults to $taxonomy key
+ *     * If false, a taxonomy cannot be loaded at ?{query_var}={term_slug}
+ *     * If specified as a string, the query ?{query_var_string}={term_slug} will be valid.
+ * - update_count_callback - Works much like a hook, in that it will be called when the count is updated.
+ *     * Defaults to _update_post_term_count() for taxonomies attached to post types, which then confirms
+ *       that the objects are published before counting them.
+ *     * Defaults to _update_generic_term_count() for taxonomies attached to other object types, such as links.
+ * - _builtin - true if this taxonomy is a native or "built-in" taxonomy. THIS IS FOR INTERNAL USE ONLY!
</ins><span class="cx">  *
</span><del>- * hierarchical - has some defined purpose at other parts of the API and is a
- * boolean value.
- *
- * update_count_callback - works much like a hook, in that it will be called when the count is updated.
- *     Defaults to _update_post_term_count() for taxonomies attached to post types, which then confirms
- *     that the objects are published before counting them.
- *     Defaults to _update_generic_term_count() for taxonomies attached to other object types, such as links.
- *
- * rewrite - false to prevent rewrite, or array('slug'=>$slug) to customize
- * permastruct; default will use $taxonomy as slug.
- *
- * query_var - false to prevent queries, or string to customize query var
- * (?$query_var=$term); default will use $taxonomy as query var.
- *
- * public - If the taxonomy should be publicly queryable; //@TODO not implemented.
- * defaults to true.
- *
- * show_ui - If the WordPress UI admin tags UI should apply to this taxonomy;
- * defaults to public.
- *
- * show_in_nav_menus - true makes this taxonomy available for selection in navigation menus.
- * Defaults to public.
- *
- * show_tagcloud - false to prevent the taxonomy being listed in the Tag Cloud Widget;
- * defaults to show_ui which defaults to public.
- *
- * labels - An array of labels for this taxonomy. You can see accepted values in {@link get_taxonomy_labels()}. By default tag labels are used for non-hierarchical types and category labels for hierarchical ones.
- *
- * description - A short descriptive summary of what the taxonomy is for. Defaults to blank.
- *
- * @package WordPress
- * @subpackage Taxonomy
</del><span class="cx">  * @since 2.3.0
</span><span class="cx">  * @uses $wp_taxonomies Inserts new taxonomy object into the list
</span><span class="cx">  * @uses $wp Adds query vars
</span><span class="cx">  *
</span><del>- * @param string $taxonomy Name of taxonomy object
</del><ins>+ * @param string $taxonomy Taxonomy key, must not exceed 32 characters.
</ins><span class="cx">  * @param array|string $object_type Name of the object type for the taxonomy object.
</span><del>- * @param array|string $args See above description for the two keys values.
</del><ins>+ * @param array|string $args See optional args description above.
</ins><span class="cx">  * @return null|WP_Error WP_Error if errors, otherwise null.
</span><span class="cx">  */
</span><span class="cx"> function register_taxonomy( $taxonomy, $object_type, $args = array() ) {
</span><span class="cx">  global $wp_taxonomies, $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(
</span><del>-               'hierarchical' => false,
</del><ins>+                'labels'                => array(),
+               'description'           => '',
+               'public'                => true,
+               'hierarchical'          => false,
+               'show_ui'               => null,
+               'show_in_nav_menus'     => null,
+               'show_tagcloud'         => null,
+               'capabilities'          => array(),
+               'rewrite'               => true,
+               'query_var'             => $taxonomy,
</ins><span class="cx">           'update_count_callback' => '',
</span><del>-               'rewrite' => true,
-               'query_var' => $taxonomy,
-               'public' => true,
-               'show_ui' => null,
-               'show_tagcloud' => null,
-               '_builtin' => false,
-               'labels' => array(),
-               'capabilities' => array(),
-               'show_in_nav_menus' => null,
-               'description' => '',
</del><ins>+                '_builtin'              => false,
</ins><span class="cx">   );
</span><del>-       $args = wp_parse_args($args, $defaults);
</del><ins>+        $args = wp_parse_args( $args, $defaults );
</ins><span class="cx"> 
</span><span class="cx">  if ( strlen( $taxonomy ) > 32 )
</span><span class="cx">          return new WP_Error( 'taxonomy_too_long', __( 'Taxonomies cannot exceed 32 characters in length' ) );
</span><span class="cx"> 
</span><del>-       if ( false !== $args['query_var'] && !empty($wp) ) {
</del><ins>+        if ( false !== $args['query_var'] && ! empty( $wp ) ) {
</ins><span class="cx">           if ( true === $args['query_var'] )
</span><span class="cx">                  $args['query_var'] = $taxonomy;
</span><span class="cx">          else
</span><del>-                       $args['query_var'] = sanitize_title_with_dashes($args['query_var']);
-               $wp->add_query_var($args['query_var']);
</del><ins>+                        $args['query_var'] = sanitize_title_with_dashes( $args['query_var'] );
+               $wp->add_query_var( $args['query_var'] );
</ins><span class="cx">   }
</span><span class="cx"> 
</span><del>-       if ( false !== $args['rewrite'] && ( is_admin() || '' != get_option('permalink_structure') ) ) {
-               $args['rewrite'] = wp_parse_args($args['rewrite'], array(
-                       'slug' => sanitize_title_with_dashes($taxonomy),
</del><ins>+        if ( false !== $args['rewrite'] && ( is_admin() || '' != get_option( 'permalink_structure' ) ) ) {
+               $args['rewrite'] = wp_parse_args( $args['rewrite'], array(
+                       'slug' => sanitize_title_with_dashes( $taxonomy ),
</ins><span class="cx">                   'with_front' => true,
</span><span class="cx">                  'hierarchical' => false,
</span><span class="cx">                  'ep_mask' => EP_NONE,
</span><del>-               ));
</del><ins>+                ) );
</ins><span class="cx"> 
</span><span class="cx">          if ( $args['hierarchical'] && $args['rewrite']['hierarchical'] )
</span><span class="cx">                  $tag = '(.+?)';
</span><span class="lines">@@ -363,14 +362,16 @@
</span><span class="cx">          add_permastruct( $taxonomy, "{$args['rewrite']['slug']}/%$taxonomy%", $args['rewrite'] );
</span><span class="cx">  }
</span><span class="cx"> 
</span><del>-       if ( is_null($args['show_ui']) )
</del><ins>+        // If not set, default to the setting for public.
+       if ( null === $args['show_ui'] )
</ins><span class="cx">           $args['show_ui'] = $args['public'];
</span><span class="cx"> 
</span><del>-       // Whether to show this type in nav-menus.php. Defaults to the setting for public.
</del><ins>+        // If not set, default to the setting for public.
</ins><span class="cx">   if ( null === $args['show_in_nav_menus'] )
</span><span class="cx">          $args['show_in_nav_menus'] = $args['public'];
</span><span class="cx"> 
</span><del>-       if ( is_null($args['show_tagcloud']) )
</del><ins>+        // If not set, default to the setting for show_ui.
+       if ( null === $args['show_tagcloud'] )
</ins><span class="cx">           $args['show_tagcloud'] = $args['show_ui'];
</span><span class="cx"> 
</span><span class="cx">  $default_caps = array(
</span><span class="lines">@@ -383,15 +384,15 @@
</span><span class="cx">  unset( $args['capabilities'] );
</span><span class="cx"> 
</span><span class="cx">  $args['name'] = $taxonomy;
</span><del>-       $args['object_type'] =  array_unique( (array)$object_type );
</del><ins>+        $args['object_type'] = array_unique( (array) $object_type );
</ins><span class="cx"> 
</span><span class="cx">  $args['labels'] = get_taxonomy_labels( (object) $args );
</span><span class="cx">  $args['label'] = $args['labels']->name;
</span><span class="cx"> 
</span><del>-       $wp_taxonomies[$taxonomy] = (object) $args;
</del><ins>+        $wp_taxonomies[ $taxonomy ] = (object) $args;
</ins><span class="cx"> 
</span><span class="cx">  // register callback handling for metabox
</span><del>-       add_filter('wp_ajax_add-' . $taxonomy, '_wp_ajax_add_hierarchical_term');
</del><ins>+        add_filter( 'wp_ajax_add-' . $taxonomy, '_wp_ajax_add_hierarchical_term' );
</ins><span class="cx"> 
</span><span class="cx">  do_action( 'registered_taxonomy', $taxonomy, $object_type, $args );
</span><span class="cx"> }
</span></span></pre>
</div>
</div>

</body>
</html>