wpseek.com
A WordPress-centric search engine for devs and theme authors



wp_feed_namespaces › WordPress Function

Since7.2.0
Deprecatedn/a
wp_feed_namespaces ( $type )
Parameters:
  • (string) $type Type of feed. Possible values include 'rss2', 'rss2-comments', 'rdf', 'atom', and 'atom-comments'.
    Required: Yes
Defined at:
Codex:

Displays the XML namespaces for the root element of a feed.

Plugins should add namespaces via the {@see 'wp_feed_namespaces'} filter instead of the older {@see "{$type}_ns"} actions, as two action callbacks printing the same namespace produce a duplicate attribute, which is a well-formedness error in XML.


Source

function wp_feed_namespaces( string $type ): void {
	foreach ( wp_get_feed_namespaces( $type ) as $prefix => $uri ) {
		printf( "xmlns:%s=\"%s\"\n\t", $prefix, esc_attr( $uri ) );
	}
}