Make WordPress Core


Ignore:
Timestamp:
09/21/2007 06:34:28 PM (18 years ago)
Author:
ryan
Message:

Export and import of post tags. fixes #4682

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/export.php

    r6130 r6149  
    140140
    141141    echo '<wp:tag_description>' . wxr_cdata($t->description) . '</wp:tag_description>';
     142}
     143
     144function wxr_post_taxonomy() {
     145    $categories = get_the_category();
     146    $tags = get_the_tags();
     147    $cat_names = array();
     148    $tag_names = array();
     149    $the_list = '';
     150    $filter = 'rss';
     151
     152    if ( !empty($categories) ) foreach ( (array) $categories as $category ) {
     153        $cat_name = sanitize_term_field('name', $category->name, $category->term_id, 'category', $filter);
     154        $the_list .= "\n\t\t<category><![CDATA[$cat_name]]></category>\n";
     155    }
     156
     157    if ( !empty($tags) ) foreach ( (array) $tags as $tag ) {
     158        $tag_name = sanitize_term_field('name', $tag->name, $tag->term_id, 'post_tag', $filter);
     159        $the_list .= "\n\t\t<category domain=\"tag\"><![CDATA[$tag_name]]></category>\n";
     160    }
     161
     162    echo $the_list;
    142163}
    143164
     
    202223<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate>
    203224<dc:creator><?php the_author() ?></dc:creator>
    204 <?php the_category_rss() ?>
     225<?php wxr_post_taxonomy() ?>
    205226
    206227<guid isPermaLink="false"><?php the_guid(); ?></guid>
Note: See TracChangeset for help on using the changeset viewer.