WordPress.org

Make WordPress Core

Ticket #9647: 9647.diff

File 9647.diff, 2.1 KB (added by arena, 9 years ago)
  • wp-includes/taxonomy.php

     
    77 * @since 2.3.0
    88 */
    99
    10 //
    11 // Taxonomy Registration
    12 //
    13 
    1410/**
    15  * Default Taxonomy Objects
    16  * @since 2.3.0
    17  * @global array $wp_taxonomies
    18  */
    19 $wp_taxonomies = array();
    20 
    21 function create_initial_taxonomies() {
    22         global $wp_taxonomies;
    23         $wp_taxonomies['category'] = (object) array('name' => 'category', 'object_type' => 'post', 'hierarchical' => true, 'update_count_callback' => '_update_post_term_count', 'label' => __('Categories'));
    24         $wp_taxonomies['post_tag'] = (object) array('name' => 'post_tag', 'object_type' => 'post', 'hierarchical' => false, 'update_count_callback' => '_update_post_term_count', 'label' => __('Post Tags'));
    25         $wp_taxonomies['link_category'] = (object) array('name' => 'link_category', 'object_type' => 'link', 'hierarchical' => false);
    26 
    27 }
    28 add_action( 'init', 'create_initial_taxonomies' );
    29 
    30 /**
    3111 * Return all of the taxonomy names that are of $object_type.
    3212 *
    3313 * It appears that this function can be used to find all of the names inside of
     
    173153function register_taxonomy( $taxonomy, $object_type, $args = array() ) {
    174154        global $wp_taxonomies, $wp_rewrite, $wp;
    175155
     156        if (!is_array($wp_taxonomies))
     157                $wp_taxonomies = array();
     158
    176159        $defaults = array('hierarchical' => false, 'update_count_callback' => '', 'rewrite' => true, 'query_var' => true);
    177160        $args = wp_parse_args($args, $defaults);
    178161
     
    23332316        return false;
    23342317}
    23352318
     2319//
     2320// Taxonomy Registration
     2321//
     2322
     2323/**
     2324 * Default Taxonomy Objects
     2325 * @since 2.3.0
     2326 * @global array $wp_taxonomies
     2327 */
     2328
     2329register_taxonomy( 'category', 'post', array('hierarchical' => true, 'update_count_callback' => '_update_post_term_count', 'label' => __('Categories')) ) ;
     2330register_taxonomy( 'post_tag', 'post', array('hierarchical' => false, 'update_count_callback' => '_update_post_term_count', 'label' => __('Post Tags')) ) ;
     2331register_taxonomy( 'link_category', 'link', array('hierarchical' => false) ) ;
    23362332?>