Proposal for a WordPress Plugin API extension

This document is obsoleted. The WordPress Plugin API now contains a set of feed action hooks.

Syndication formats like RSS and ATOM are designed to be extensible. A number of extension modules are proposed, with the purpose of increase the semantic content of syndication feeds without bloating the core format specifications.

This draft proposes an extension to the WordPress Plugin API that allows plugin developers to add custom metadata in WP-created feeds.

API extensions

Hook functions

wp_feed_namespace
Allows to add XML namespaces for extension modules. The hook function receives the feed type as a parameter.
wp_feed_channel
Executes inside the channel section of RSS feeds and the feed section of ATOM feeds. Allows to add channel-level metadata. The hook function receives the feed type as a parameter.
wp_feed_item
Executes inside the item section of RSS feeds and the entry section of ATOM feeds. Allows to add post-level metadata. Loop template tags can be used. The hook function receives the feed type and the post ID as parameters. For comments feed, the comment ID is passed as third parameter.
wp_feed_rdf
Executes inside the root of the RDF document, for RSS 1.0 feeds only. No parameters.

Parameter values

Values for the “feed type” parameter are:

‘rss2′
For RSS2 feeds
‘commentsrss2′
For RSS 2.0 comments feeds
‘rdf’
for RSS 1.0 feeds
‘atom’
for ATOM feeds

Example

This example plugin adds trackback informations (http://madskills.com/public/xml/rss/module/trackback/) and Creative Commons informations (http://backend.userland.com/creativeCommonsRssModulehttp://web.resource.org/rss/1.0/modules/cc/) in RSS and ATOM feeds.

See the results on my website’s feeds:

Copyright © Fabrizio Tarizzo

This work is licensed under the Creative Commons Attribution-Share Alike 3.0 Italy License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/it/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.