Ticket #19275: 19275.diff
| File 19275.diff, 4.7 KB (added by , 14 years ago) |
|---|
-
wp-includes/taxonomy.php
23 23 'rewrite' => did_action( 'init' ) ? array( 24 24 'hierarchical' => true, 25 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 ) : false, 26 'with_front' => ( get_option('category_base') && ! $wp_rewrite->using_index_permalinks() ) ? false : true, 27 'ep_mask' => EP_CATEGORIES, 28 ) : false, 27 29 'public' => true, 28 30 'show_ui' => true, 29 31 '_builtin' => true, … … 34 36 'query_var' => 'tag', 35 37 'rewrite' => did_action( 'init' ) ? array( 36 38 'slug' => get_option('tag_base') ? get_option('tag_base') : 'tag', 37 'with_front' => ( get_option('tag_base') && ! $wp_rewrite->using_index_permalinks() ) ? false : true ) : false, 39 'with_front' => ( get_option('tag_base') && ! $wp_rewrite->using_index_permalinks() ) ? false : true, 40 'ep_mask' => EP_TAGS, 41 ) : false, 38 42 'public' => true, 39 43 'show_ui' => true, 40 44 '_builtin' => true, … … 322 326 $args['rewrite'] = wp_parse_args($args['rewrite'], array( 323 327 'slug' => sanitize_title_with_dashes($taxonomy), 324 328 'with_front' => true, 325 'hierarchical' => false 329 'hierarchical' => false, 330 'ep_mask' => EP_NONE, 326 331 )); 327 332 328 333 if ( $args['hierarchical'] && $args['rewrite']['hierarchical'] ) … … 331 336 $tag = '([^/]+)'; 332 337 333 338 $wp_rewrite->add_rewrite_tag("%$taxonomy%", $tag, $args['query_var'] ? "{$args['query_var']}=" : "taxonomy=$taxonomy&term="); 334 $wp_rewrite->add_permastruct($taxonomy, "{$args['rewrite']['slug']}/%$taxonomy%", $args['rewrite']['with_front'] );339 $wp_rewrite->add_permastruct($taxonomy, "{$args['rewrite']['slug']}/%$taxonomy%", $args['rewrite']['with_front'], $args['rewrite']['ep_mask'] ); 335 340 } 336 341 337 342 if ( is_null($args['show_ui']) ) -
wp-includes/post.php
893 893 * register_taxonomy_for_object_type(). 894 894 * - labels - An array of labels for this post type. By default post labels are used for non-hierarchical 895 895 * types and page labels for hierarchical ones. You can see accepted values in {@link get_post_type_labels()}. 896 * - permalink_epmask - The default rewrite endpoint bitmasks.897 896 * - has_archive - True to enable post type archives. Will generate the proper rewrite rules if rewrite is enabled. 898 897 * - rewrite - false to prevent rewrite. Defaults to true. Use array('slug'=>$slug) to customize permastruct; 899 * default will use $post_type as slug. Other options include 'with_front', 'feeds', and 'pages'.898 * default will use $post_type as slug. Other options include 'with_front', 'feeds', 'pages', and 'ep_mask'. 900 899 * - query_var - false to prevent queries, or string to value of the query var to use for this post type 901 900 * - can_export - true allows this post type to be exported. 902 901 * - show_in_nav_menus - true makes this post type available for selection in navigation menus. … … 924 923 'public' => false, 'rewrite' => true, 'has_archive' => false, 'query_var' => true, 925 924 'supports' => array(), 'register_meta_box_cb' => null, 926 925 'taxonomies' => array(), 'show_ui' => null, 'menu_position' => null, 'menu_icon' => null, 927 ' permalink_epmask' => EP_PERMALINK, 'can_export' => true,926 'can_export' => true, 928 927 'show_in_nav_menus' => null, 'show_in_menu' => null, 'show_in_admin_bar' => null, 929 928 ); 930 929 $args = wp_parse_args($args, $defaults); … … 999 998 $args->rewrite['pages'] = true; 1000 999 if ( ! isset( $args->rewrite['feeds'] ) || ! $args->has_archive ) 1001 1000 $args->rewrite['feeds'] = (bool) $args->has_archive; 1001 if ( ! isset( $args->rewrite['ep_mask'] ) ) { 1002 if ( isset( $args['permalink_epmask'] ) ) 1003 $args->rewrite['ep_mask'] = $args['permalink_epmask']; 1004 else 1005 $args->rewrite['ep_mask'] = EP_PERMALINK; 1006 } 1002 1007 1003 1008 if ( $args->hierarchical ) 1004 1009 $wp_rewrite->add_rewrite_tag("%$post_type%", '(.+?)', $args->query_var ? "{$args->query_var}=" : "post_type=$post_type&name="); … … 1022 1027 $wp_rewrite->add_rule( "{$archive_slug}/{$wp_rewrite->pagination_base}/([0-9]{1,})/?$", "index.php?post_type=$post_type" . '&paged=$matches[1]', 'top' ); 1023 1028 } 1024 1029 1025 $wp_rewrite->add_permastruct( $post_type, "{$args->rewrite['slug']}/%$post_type%", $args->rewrite['with_front'], $args->permalink_epmask);1030 $wp_rewrite->add_permastruct( $post_type, "{$args->rewrite['slug']}/%$post_type%", $args->rewrite['with_front'], $args->rewrite['ep_mask'] ); 1026 1031 } 1027 1032 1028 1033 if ( $args->register_meta_box_cb )