Make Custom Taxonomy Feeds Auto-discoverable

This helps improve the parity between custom taxonomies and built in taxonomies. It is one small step to #makeCustomTaxonomyFeedsGreatAgain.

Fixes #23677
Props mdgl, stevenkword



git-svn-id: https://develop.svn.wordpress.org/trunk@36671 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Aaron Jorbin 2016-02-24 02:35:23 +00:00
parent 9c474ff900
commit 31e4c5c5d9
1 changed files with 7 additions and 0 deletions

View File

@ -2535,6 +2535,8 @@ function feed_links_extra( $args = array() ) {
'cattitle' => __('%1$s %2$s %3$s Category Feed'),
/* translators: 1: blog name, 2: separator(raquo), 3: tag name */
'tagtitle' => __('%1$s %2$s %3$s Tag Feed'),
/* translators: 1: blog name, 2: separator(raquo), 3: term name, 4: taxonomy singular name */
'taxtitle' => __('%1$s %2$s %3$s %4$s Feed'),
/* translators: 1: blog name, 2: separator(raquo), 3: author name */
'authortitle' => __('%1$s %2$s Posts by %3$s Feed'),
/* translators: 1: blog name, 2: separator(raquo), 3: search phrase */
@ -2575,6 +2577,11 @@ function feed_links_extra( $args = array() ) {
$title = sprintf( $args['tagtitle'], get_bloginfo('name'), $args['separator'], $term->name );
$href = get_tag_feed_link( $term->term_id );
}
} elseif ( is_tax() ) {
$term = get_queried_object();
$tax = get_taxonomy( $term->taxonomy );
$title = sprintf( $args['taxtitle'], get_bloginfo('name'), $args['separator'], $term->name, $tax->labels->singular_name );
$href = get_term_feed_link( $term->term_id, $term->taxonomy );
} elseif ( is_author() ) {
$author_id = intval( get_query_var('author') );