WordPress.org

Make WordPress Core

Ticket #9674: 9674_taxonomies.diff

File 9674_taxonomies.diff, 1.3 KB (added by technosailor, 4 years ago)

Support default registration of post_tag and category taxonomies for custom content type

  • wp-includes/post.php

     
    725725                $wp_post_types = array(); 
    726726 
    727727        // Args prefixed with an underscore are reserved for internal use. 
    728         $defaults = array('label' => false, 'publicly_queryable' => null, 'exclude_from_search' => null, '_builtin' => false, '_edit_link' => 'post.php?post=%d', 'capability_type' => 'post', 'hierarchical' => false, 'public' => false, '_show' => false, 'rewrite' => true, 'query_var' => true, 'supports' => array(), 'register_meta_box_cb' => null); 
     728        $defaults = array('label' => false, 'publicly_queryable' => null, 'exclude_from_search' => null, '_builtin' => false, '_edit_link' => 'post.php?post=%d', 'capability_type' => 'post', 'hierarchical' => false, 'public' => false, '_show' => false, 'rewrite' => true, 'query_var' => true, 'supports' => array(), 'register_meta_box_cb' => null, 'taxonomies' => array() ); 
    729729        $args = wp_parse_args($args, $defaults); 
    730730        $args = (object) $args; 
    731731 
     
    789789 
    790790        $wp_post_types[$post_type] = $args; 
    791791 
     792        foreach( $args->taxonomies as $taxonomy ) { 
     793                register_taxonomy_for_object_type( $taxonomy, $post_type ); 
     794        } 
     795         
    792796        return $args; 
    793797} 
    794798