I made a mess of this in comments, so will start from scratch.
The feed links for archive pages are usually only outputted for browser detection by feed_links_extra()
.
From looking at its source there is number of different function to get link for the archive pages:
get_category_feed_link( $cat_id )
;get_tag_feed_link( $tag_id )
;get_term_feed_link( $term_id, $taxonomy )
(this one I found separately, not currently used in automatic feed links).
So catch-all archive feed link that will work for any taxonomy (including categories and terms) can be built like this:
function archive_feed_link() {
if( is_archive() ) {
global $wp_query;
$taxonomy = $wp_query->get_queried_object();
return get_term_feed_link( $taxonomy->term_id, $taxonomy->taxonomy );
}
}
Related Posts:
- Nice RSS Feed URLs for each custom post type
- WordPress Permalinks %postname% for RSS2 Feed URL
- How to Get Page 2 / Paginated RSS Feed with Custom Permalink Structure?
- How to redirect RSS feeds to Feedburner and keep pretty permalinks?
- Why is my RSS feed not working?
- Edit permalink for old posts and not show on top of RSS feed
- I need to change the attribute of the isPermaLink guid in the WordPress RSS feed – from false to true
- WordPress 4.0 beta – how to change the link URL in RSS feeds
- Appending a variable to RSS link url
- RSS feed URL for post comment shows HTML source code of page
- Need help with add_rewrite_rule
- How to get pretty URLs with add_query_arg in permalinks
- Removing Parent Page(s) from Permalink
- Prevent WordPress from abbreviating-long-slugs…-in-the-admin
- Page begins with number, WordPress adds 2
- Permalinks to Custom does not work (out of box)
- Why don’t WordPress post slugs allow accents?
- Multi-language permalink in qtranslate
- Modify get_permalink with a specific filter
- Include Taxonomy slug in post url
- How to set permalink to fetch all children custom posts with parent post in wordpress?
- Rewrite url / permalink for default archive – yearly / monthly
- Should I use relative or absolute urls when pointing to internal pages
- How to change the link structure of the homepage?
- WordPress on VirtualBox – no pretty permalinks
- permalinks has -2 with post name structure. why?
- How can I change permalinks to use a different domain and path from where the blog is hosted?
- Gutenberg Editor: dynamicaly change slug field with an ACF field
- Child pages with same slug
- Permalinks, Rewrites, Get Variables, Oh My!
- Remove words from permalink when saving post automatically?
- Permalink problem
- Removing leading zeros from custom permalink structure
- When is it a good idea to build a permalink structure from scratch?
- How to reset canonical URLs / fix redirect loop
- Trailing slash at the end of permalink loads faster / better SEO?
- WordPress blog posts permalinks giving 404 on nginx
- Permalinks by page/post name returning 404
- Changing the post date without causing 404 error
- Rewrite rule for a query string
- Why does the ‘Month and Name’ Permalink Format not Work on my new WordPress Site (running on IIS7)?
- How do I add /blog/ as a prefix to permalink structure for posts, categories & tags?
- Custom permalink structure for posts in specific category
- force permalink slug for page vs post_type slug parent
- WordPress url ingore permalinks setting [closed]
- Rewrite URLs for LeadPages due to subdirectory installation
- After updage wordpress 4.4 to 4.5 nginx config works not properly
- All URLs are having ‘/blog/’ appended to them.
- A link to a page including an anchor doesn’t go to that anchor – URL gets changed
- Default permalink changes
- WordPress Permalink feature alternative
- How can I emulate permalink behaviour on static pages
- Unique one time use URL
- the_permalink on the homepage vs posts for sharing links
- Media/attachment urls don’t redirect with fake URL structure
- Test site pages go to main site
- when I create a page with a /blog permalink the css gets messed up
- Inserting a string in the middle of page’s permalink?
- 404 on internal pages, in all sites in my local server
- how to alter permalink in wordpress?
- Adding User Info to Permalink of User pages – is it neccessary?
- Pagination using paginate_links
- add_rewrite_rule – Page Slug from “/foo-bar/” to “/foo/bar/”
- Permalink will not change – it wants to have -2 slug [duplicate]
- Permalinks 404 after Subdirectory to Root Migration
- Access or edit custom generated permalinks with WP_Rewrite
- Add custom query vars to pretty permalinks
- Custom permalink structure only saves with index.php inserted
- Two custom taxonomies in permalink structure
- What is the simplest way to create a redirect
- the_permalink() not working
- All in One Seo and Permalinks
- Already have htaccess but permalink settings not working. Getting 404
- How to turn a custom query string into permalink?
- How can i fix my permalinks?
- Adding custom query var to a single post without redirecting to its root slug
- Custom structure permalink preventing 404
- Flush rewrite rules with scheduled event (cron)
- I have a 404 error on all my pages! What do I do?
- All files in public_html, Cannot launch WordPress site via wp-admin
- Add slug to default post permalinks ONLY
- Propper way to set anchor and url param
- Prevent 301 when a trailing slash added
- Do shortcodes in title before permalink is generated
- How to change dynamic link to relevant post
- Auto-generated pretty permalink not using title since 4.4 update
- Pretty permalinks returning “not found” on localhost and server
- Removing or hiding slug/permalink from htaccess
- Problems with permalinks after update wordpress 4.2
- WordPress Permalink Problem
- Latin character conversion
- Update permalinks
- Losing the original URL when using add_rewrite_rule
- broken permalinks in responsive layout
- Permalink issues with Ubuntu Server – Infinite loop & Wrong pages
- How to get the perfect WordPress, WooCommerce, Custom Post Type pretty permalinks?
- WordPress keep redirecting me to random URLs
- Not recognizing my custom templates in hierarchy
- How to make a permalink variable %year% become two digits instead of four digits?
- Remove parent product category slug from product_cat url woocommerce