Ticket #13058: 13058.diff
| File 13058.diff, 3.2 KB (added by blepoxp, 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_taxonomy_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 taxonomy. A specific feed 578 * can be requested or left blank to get the default feed. 579 * 580 * @package WordPress 581 * @subpackage Feed 582 * @since 3.0 583 * 584 * @param int $term_id ID of a category. 585 * @param string $taxonomy Optional. Taxonomy of $term_id 586 * @param string $feed Optional. Feed type. 587 * @return string Link to the feed for the taxonomy specified by $term_id and $taxonomy. 588 */ 589 function get_taxonomy_feed_link($term_id, $taxonomy='category', $feed = '') { 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 597 if ( empty($feed) ) … … 581 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 $link = home_url("?feed=$feed&".$term->taxonomy."=".$term->slug); 607 } 585 608 } else { 586 $link = get_ category_link($cat_id);609 $link = get_term_link($term_id,$term->taxonomy); 587 610 if( $feed == get_default_feed() ) 588 611 $feed_link = 'feed'; 589 612 else … … 592 615 $link = trailingslashit($link) . user_trailingslashit($feed_link, 'feed'); 593 616 } 594 617 595 $link = apply_filters('category_feed_link', $link, $feed); 618 if ( 'category' == $taxonomy ){ 619 $link = apply_filters('category_feed_link', $link, $feed); 620 }else{ 621 $link = apply_filters('taxonomy_feed_link', $link, $feed, $taxonomy); 622 } 596 623 597 624 return $link; 598 625 } -
wp-includes/classes.php
1452 1452 if ( empty($feed_image) ) 1453 1453 $link .= '('; 1454 1454 1455 $link .= '<a href="' . get_ category_feed_link($category->term_id, $feed_type) . '"';1455 $link .= '<a href="' . get_taxonomy_feed_link($category->term_id, $category->taxonomy, $feed_type) . '"'; 1456 1456 1457 1457 if ( empty($feed) ) 1458 1458 $alt = ' alt="' . sprintf(__( 'Feed for all posts filed under %s' ), $cat_name ) . '"'; -
xmlrpc.php
2734 2734 $struct['categoryDescription'] = $cat->description; 2735 2735 $struct['categoryName'] = $cat->name; 2736 2736 $struct['htmlUrl'] = esc_html(get_category_link($cat->term_id)); 2737 $struct['rssUrl'] = esc_html(get_category_feed_link($cat->term_id, 'rss2'));2737 $struct['rssUrl'] = esc_html(get_category_feed_link($cat->term_id, $cat->taxonomy, 'rss2')); 2738 2738 2739 2739 $categories_struct[] = $struct; 2740 2740 }
