wxr_post_taxonomy() WordPress Function

The wxr_post_taxonomy() function is used to generate a WordPress XML file for a given post type and taxonomy. This function can be used to create an XML file for any custom post type and taxonomy.

wxr_post_taxonomy() #

Output list of taxonomy terms, in XML tag format, associated with a post


Source

File: wp-admin/includes/export.php

	function wxr_post_taxonomy() {
		$post = get_post();

		$taxonomies = get_object_taxonomies( $post->post_type );
		if ( empty( $taxonomies ) ) {
			return;
		}
		$terms = wp_get_object_terms( $post->ID, $taxonomies );

		foreach ( (array) $terms as $term ) {
			echo "\t\t<category domain=\"{$term->taxonomy}\" nicename=\"{$term->slug}\">" . wxr_cdata( $term->name ) . "</category>\n";
		}
	}


Top ↑

Changelog

Changelog
VersionDescription
2.3.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.