wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



wp_feed_namespaces › WordPress Function

Seit7.2.0
Veraltetn/v
wp_feed_namespaces ( $type )
Parameter:
  • (string) $type Type of feed. Possible values include 'rss2', 'rss2-comments', 'rdf', 'atom', and 'atom-comments'.
    Erforderlich: Ja
Definiert in:
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.


Quellcode

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 ) );
	}
}