Ticket #5173: getcatfeedlink.diff
| File getcatfeedlink.diff, 1.4 KB (added by ionfish, 5 years ago) |
|---|
-
wp-includes/feed.php
128 128 } 129 129 130 130 131 function get_category_rss_link($echo = false, $cat_ID, $category_nicename) { 131 function get_category_feed_link($cat_id, $feed = 'rss2') { 132 $cat_id = (int) $cat_id; 133 134 $category = get_category($cat_id); 135 136 if ( empty($category) || is_wp_error($category) ) 137 return false; 138 132 139 $permalink_structure = get_option('permalink_structure'); 133 140 134 141 if ( '' == $permalink_structure ) { 135 $link = get_option('home') . '?feed=rss2&cat=' . $cat_ID;142 $link = get_option('home') . "?feed=$feed&cat=" . $cat_id; 136 143 } else { 137 $link = get_category_link($cat_ID); 138 $link = trailingslashit($link) . user_trailingslashit('feed', 'feed'); 144 $link = get_category_link($cat_id); 145 if( 'rss2' == $feed ) 146 $feed_link = 'feed'; 147 else 148 $feed_link = "feed/$feed"; 149 150 $link = trailingslashit($link) . user_trailingslashit($feed_link, 'feed'); 139 151 } 140 152 141 $link = apply_filters('category_feed_link', $link); 153 $link = apply_filters('category_feed_link', $link, $feed); 154 155 return $link; 156 } 142 157 158 159 function get_category_rss_link($echo = false, $cat_ID, $category_nicename) { 160 $link = get_category_feed_link($cat_ID, $feed = 'rss2'); 161 143 162 if ( $echo ) 144 163 echo $link; 145 164 return $link;
