Ticket #43746: 43746.diff
| File 43746.diff, 4.4 KB (added by , 8 years ago) |
|---|
-
src/wp-includes/class-wp-post-type.php
diff --git src/wp-includes/class-wp-post-type.php src/wp-includes/class-wp-post-type.php index ba37a02..27de268 100644
final class WP_Post_Type { 489 489 if ( ! isset( $args['rewrite']['feeds'] ) || ! $args['has_archive'] ) { 490 490 $args['rewrite']['feeds'] = (bool) $args['has_archive']; 491 491 } 492 if ( ! isset( $args['rewrite']['single_feed'] ) ) { 493 $args['rewrite']['single_feed'] = false; 494 } 492 495 if ( ! isset( $args['rewrite']['ep_mask'] ) ) { 493 496 if ( isset( $args['permalink_epmask'] ) ) { 494 497 $args['rewrite']['ep_mask'] = $args['permalink_epmask']; … … final class WP_Post_Type { 562 565 } 563 566 } 564 567 568 // Add comment feed. 569 if ( $this->rewrite['single_feed'] ) { 570 $slug = $this->rewrite['slug']; 571 $feeds = '(' . trim( implode( '|', $wp_rewrite->feeds ) ) . ')'; 572 if ( $this->hierarchical ) { 573 $match = '(.+?)'; 574 $rewrite = $this->query_var ? "{$this->query_var}=" : "post_type=$this->name&pagename="; 575 } else { 576 $match = '([^/]+)'; 577 $rewrite = $this->query_var ? "{$this->query_var}=" : "post_type=$this->name&name="; 578 } 579 add_rewrite_rule( "$slug/$match/feed/$feeds/?", $rewrite, 'top' ); 580 add_rewrite_rule( "$slug/$match/$feeds/?", $rewrite, 'top' ); 581 } 582 565 583 $permastruct_args = $this->rewrite; 566 584 $permastruct_args['feed'] = $permastruct_args['feeds']; 567 585 add_permastruct( $this->name, "{$this->rewrite['slug']}/%$this->name%", $permastruct_args ); -
src/wp-includes/post.php
diff --git src/wp-includes/post.php src/wp-includes/post.php index cb5025f..80891a0 100644
function get_post_types( $args = array(), $output = 'names', $operator = 'and' ) 1158 1158 * @since 4.6.0 Post type object returned is now an instance of `WP_Post_Type`. 1159 1159 * @since 4.7.0 Introduced `show_in_rest`, `rest_base` and `rest_controller_class` 1160 1160 * arguments to register the post type in REST API. 1161 * @since 5.0.0 Introduced the `single_feed` rewrite parameter that builds 1162 * single feed rewrites for custom post types if needed. 1161 1163 * 1162 1164 * @global array $wp_post_types List of post types. 1163 1165 * … … function get_post_types( $args = array(), $output = 'names', $operator = 'and' ) 1245 1247 * Defaults to true, using $post_type as slug. To specify rewrite rules, an array can be 1246 1248 * passed with any of these keys: 1247 1249 * 1248 * @type string $slug Customize the permastruct slug. Defaults to $post_type key. 1249 * @type bool $with_front Whether the permastruct should be prepended with WP_Rewrite::$front. 1250 * Default true. 1251 * @type bool $feeds Whether the feed permastruct should be built for this post type. 1252 * Default is value of $has_archive. 1253 * @type bool $pages Whether the permastruct should provide for pagination. Default true. 1254 * @type const $ep_mask Endpoint mask to assign. If not specified and permalink_epmask is set, 1255 * inherits from $permalink_epmask. If not specified and permalink_epmask 1256 * is not set, defaults to EP_PERMALINK. 1250 * @type string $slug Customize the permastruct slug. Defaults to $post_type key. 1251 * @type bool $with_front Whether the permastruct should be prepended with WP_Rewrite::$front. 1252 * Default true. 1253 * @type bool $feeds Whether the feed permastruct should be built for this post type. 1254 * Default is value of $has_archive. 1255 * @type bool $single_feed Whether a single feed permasturct should be built for this post type. 1256 * Default false. 1257 * @type bool $pages Whether the permastruct should provide for pagination. Default true. 1258 * @type const $ep_mask Endpoint mask to assign. If not specified and permalink_epmask is set, 1259 * inherits from $permalink_epmask. If not specified and permalink_epmask 1260 * is not set, defaults to EP_PERMALINK. 1257 1261 * } 1258 1262 * @type string|bool $query_var Sets the query_var key for this post type. Defaults to $post_type 1259 1263 * key. If false, a post type cannot be loaded at