Changeset 19741 for trunk/wp-includes/taxonomy.php
- Timestamp:
- 01/23/2012 07:58:26 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/taxonomy.php
r19738 r19741 13 13 14 14 /** 15 * Creates the initial taxonomies when 'init' action is fired. 15 * Creates the initial taxonomies. 16 * 17 * This function fires twice: in wp-settings.php before plugins are loaded (for 18 * backwards compatibility reasons), and again on the 'init' action. We must avoid 19 * registering rewrite rules before the 'init' action. 16 20 */ 17 21 function create_initial_taxonomies() { 18 22 global $wp_rewrite; 23 24 if ( ! did_action( 'init' ) ) { 25 $rewrite = array( 'category' => false, 'post_tag' => false, 'post_format' => false ); 26 } else { 27 $post_format_base = apply_filters( 'post_format_rewrite_base', 'type' ); 28 $rewrite = array( 29 'category' => array( 30 'hierarchical' => true, 31 'slug' => get_option('category_base') ? get_option('category_base') : 'category', 32 'with_front' => get_option('category_base') || $wp_rewrite->using_index_permalinks(), 33 'ep_mask' => EP_CATEGORIES, 34 ), 35 'post_tag' => array( 36 'slug' => get_option('tag_base') ? get_option('tag_base') : 'tag', 37 'with_front' => get_option('tag_base') || $wp_rewrite->using_index_permalinks(), 38 'ep_mask' => EP_TAGS, 39 ), 40 'post_format' => $post_format_base ? array( 'slug' => $post_format_base ) : false, 41 ); 42 } 19 43 20 44 register_taxonomy( 'category', 'post', array( 21 45 'hierarchical' => true, 22 46 'query_var' => 'category_name', 23 'rewrite' => did_action( 'init' ) ? array( 24 'hierarchical' => true, 25 'slug' => get_option('category_base') ? get_option('category_base') : 'category', 26 'with_front' => ( get_option('category_base') && ! $wp_rewrite->using_index_permalinks() ) ? false : true, 27 'ep_mask' => EP_CATEGORIES, 28 ) : false, 47 'rewrite' => $rewrite['category'], 29 48 'public' => true, 30 49 'show_ui' => true, … … 35 54 'hierarchical' => false, 36 55 'query_var' => 'tag', 37 'rewrite' => did_action( 'init' ) ? array( 38 'slug' => get_option('tag_base') ? get_option('tag_base') : 'tag', 39 'with_front' => ( get_option('tag_base') && ! $wp_rewrite->using_index_permalinks() ) ? false : true, 40 'ep_mask' => EP_TAGS, 41 ) : false, 56 'rewrite' => $rewrite['post_tag'], 42 57 'public' => true, 43 58 'show_ui' => true, … … 82 97 ) ); 83 98 84 $rewrite = false;85 if ( did_action( 'init' ) ) {86 $rewrite = apply_filters( 'post_format_rewrite_base', 'type' );87 $rewrite = $rewrite ? array( 'slug' => $rewrite ) : false;88 }89 90 99 register_taxonomy( 'post_format', 'post', array( 91 100 'public' => true, … … 96 105 ), 97 106 'query_var' => true, 98 'rewrite' => $rewrite ,107 'rewrite' => $rewrite['post_format'], 99 108 'show_ui' => false, 100 109 '_builtin' => true,
Note: See TracChangeset
for help on using the changeset viewer.