The feed_links() WordPress PHP function is used to display the links to the general feeds.
Usage
You can utilize this function to display RSS feed links on your WordPress site. Here’s a simple example:
feed_links();
Parameters
- $args array Optional (Array): This is an optional argument that you can pass to the function. The default value is an empty array.
More information
See WordPress Developer Resources: feed_links()
This function has been a part of WordPress’s core functionality for quite a while and is still in active use as of the latest versions. If there are any changes to this function, it will be updated on the WordPress Developer Resources page.
Examples
Displaying Basic Feed Links
In this example, the feed_links() function is used without any arguments to simply display the default feed links.
feed_links(); // This will display the default feed links
Customizing Feed Links
In this example, the feed_links() function is given an array argument to customize the feed links.
feed_links(array( 'separator' => ' | ', 'postfeed' => 'Post Feed Link', 'commentfeed' => 'Comment Feed Link', )); // This will display the feed links with a '|' separator and custom names
Displaying Only Post Feed Link
In this case, the feed_links() function is used to display only the post feed link and not the comments feed link.
feed_links(array( 'comments' => false, )); // This will display only the post feed link
Displaying Only Comment Feed Link
This is an opposite example to the previous one, where we display only the comments feed link.
feed_links(array( 'posts' => false, )); // This will display only the comments feed link
Removing Separator
In the final example, the feed_links() function is used to display the feed links without any separator.
feed_links(array( 'separator' => '', )); // This will display the feed links without any separator