From d440214a7b5e3641f3139d0ead873ddec5e20bbf Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Thu, 11 Feb 2010 19:17:00 +0000 Subject: [PATCH] Export post <-> term relationships for all taxonomies. fixes #12180 git-svn-id: https://develop.svn.wordpress.org/trunk@13055 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/includes/export.php | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/wp-admin/includes/export.php b/wp-admin/includes/export.php index 0a64a40b16..1877b05f37 100644 --- a/wp-admin/includes/export.php +++ b/wp-admin/includes/export.php @@ -223,27 +223,24 @@ function wxr_term_description($t) { * @since unknown */ function wxr_post_taxonomy() { - $categories = get_the_category(); - $tags = get_the_tags(); + global $post; + $the_list = ''; $filter = 'rss'; - if ( !empty($categories) ) foreach ( (array) $categories as $category ) { - $cat_name = sanitize_term_field('name', $category->name, $category->term_id, 'category', $filter); - // for backwards compatibility - $the_list .= "\n\t\t\n"; - // forwards compatibility: use a unique identifier for each cat to avoid clashes - // http://trac.wordpress.org/ticket/5447 - $the_list .= "\n\t\tslug}\">\n"; - } - - if ( !empty($tags) ) foreach ( (array) $tags as $tag ) { - $tag_name = sanitize_term_field('name', $tag->name, $tag->term_id, 'post_tag', $filter); - $the_list .= "\n\t\t\n"; + $taxonomies = get_object_taxonomies('post'); + $terms = wp_get_post_terms($post->ID, $taxonomies); + foreach ( (array) $terms as $term ) { + $domain = ( 'post_tag' == $term->taxonomy ) ? 'tag' : $term->taxonomy; + $term_name = sanitize_term_field('name', $term->name, $term->term_id, $term->taxonomy, $filter); + // Back compat. + if ( 'category' == $term->taxonomy ) + $the_list .= "\n\t\t\n"; + elseif ( 'post_tag' == $term->taxonomy ) + $the_list .= "\n\t\t\n"; // forwards compatibility as above - $the_list .= "\n\t\tslug}\">\n"; + $the_list .= "\n\t\tslug}\">\n"; } - echo $the_list; }