Ticket #13058: 13058.2.diff
| File 13058.2.diff, 2.9 KB (added by ryan, 3 years ago) |
|---|
-
wp-includes/link-template.php
568 568 * @return string Link to the feed for the category specified by $cat_id. 569 569 */ 570 570 function get_category_feed_link($cat_id, $feed = '') { 571 $cat_id = (int) $cat_id; 571 return get_term_feed_link($cat_id, 'category', $feed); 572 } 572 573 573 $category = get_category($cat_id); 574 /** 575 * Retrieve the feed link for a taxonomy. 576 * 577 * Returns a link to the feed for all post in a given term. A specific feed 578 * can be requested or left blank to get the default feed. 579 * 580 * @since 3.0 581 * 582 * @param int $term_id ID of a category. 583 * @param string $taxonomy Optional. Taxonomy of $term_id 584 * @param string $feed Optional. Feed type. 585 * @return string Link to the feed for the taxonomy specified by $term_id and $taxonomy. 586 */ 587 function get_term_feed_link( $term_id, $taxonomy = 'category', $feed = '' ) { 588 global $wp_rewrite; 589 590 $term_id = ( int ) $term_id; 574 591 575 if ( empty($category) || is_wp_error($category) ) 592 $term = get_term( $term_id, $taxonomy ); 593 594 if ( empty( $term ) || is_wp_error( $term ) ) 576 595 return false; 577 596 578 if ( empty( $feed) )597 if ( empty( $feed ) ) 579 598 $feed = get_default_feed(); 580 599 581 $permalink_structure = get_option( 'permalink_structure');600 $permalink_structure = get_option( 'permalink_structure' ); 582 601 583 602 if ( '' == $permalink_structure ) { 584 $link = home_url("?feed=$feed&cat=" . $cat_id); 603 if ( 'category' == $taxonomy ) { 604 $link = home_url("?feed=$feed&cat=$term_id"); 605 } else { 606 $t = get_taxonomy( $taxonomy ); 607 $link = home_url("feed=$feed&$t->query_var=$term->slug"); 608 } 585 609 } else { 586 $link = get_ category_link($cat_id);587 if ( $feed == get_default_feed() )610 $link = get_term_link( $term_id, $term->taxonomy ); 611 if ( $feed == get_default_feed() ) 588 612 $feed_link = 'feed'; 589 613 else 590 614 $feed_link = "feed/$feed"; 591 615 592 $link = trailingslashit( $link) . user_trailingslashit($feed_link, 'feed');616 $link = trailingslashit( $link ) . user_trailingslashit( $feed_link, 'feed' ); 593 617 } 594 618 595 $link = apply_filters('category_feed_link', $link, $feed); 619 if ( 'category' == $taxonomy ) 620 $link = apply_filters( 'category_feed_link', $link, $feed ); 621 else 622 $link = apply_filters( 'taxonomy_feed_link', $link, $feed, $taxonomy ); 623 596 624 597 625 return $link; 598 626 } -
wp-includes/classes.php
1356 1356 if ( empty($feed_image) ) 1357 1357 $link .= '('; 1358 1358 1359 $link .= '<a href="' . get_ category_feed_link($category->term_id, $feed_type) . '"';1359 $link .= '<a href="' . get_term_feed_link( $category->term_id, $category->taxonomy, $feed_type ) . '"'; 1360 1360 1361 1361 if ( empty($feed) ) 1362 1362 $alt = ' alt="' . sprintf(__( 'Feed for all posts filed under %s' ), $cat_name ) . '"';
