Changeset 13055
- Timestamp:
- 02/11/2010 07:17:00 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/export.php
r12657 r13055 224 224 */ 225 225 function wxr_post_taxonomy() { 226 $categories = get_the_category();227 $tags = get_the_tags(); 226 global $post; 227 228 228 $the_list = ''; 229 229 $filter = 'rss'; 230 230 231 if ( !empty($categories) ) foreach ( (array) $categories as $category ) { 232 $cat_name = sanitize_term_field('name', $category->name, $category->term_id, 'category', $filter); 233 // for backwards compatibility 234 $the_list .= "\n\t\t<category><![CDATA[$cat_name]]></category>\n"; 235 // forwards compatibility: use a unique identifier for each cat to avoid clashes 236 // http://trac.wordpress.org/ticket/5447 237 $the_list .= "\n\t\t<category domain=\"category\" nicename=\"{$category->slug}\"><![CDATA[$cat_name]]></category>\n"; 231 $taxonomies = get_object_taxonomies('post'); 232 $terms = wp_get_post_terms($post->ID, $taxonomies); 233 foreach ( (array) $terms as $term ) { 234 $domain = ( 'post_tag' == $term->taxonomy ) ? 'tag' : $term->taxonomy; 235 $term_name = sanitize_term_field('name', $term->name, $term->term_id, $term->taxonomy, $filter); 236 // Back compat. 237 if ( 'category' == $term->taxonomy ) 238 $the_list .= "\n\t\t<category><![CDATA[$term_name]]></category>\n"; 239 elseif ( 'post_tag' == $term->taxonomy ) 240 $the_list .= "\n\t\t<category domain=\"$domain\"><![CDATA[$term_name]]></category>\n"; 241 // forwards compatibility as above 242 $the_list .= "\n\t\t<category domain=\"$domain\" nicename=\"{$term->slug}\"><![CDATA[$term_name]]></category>\n"; 238 243 } 239 240 if ( !empty($tags) ) foreach ( (array) $tags as $tag ) {241 $tag_name = sanitize_term_field('name', $tag->name, $tag->term_id, 'post_tag', $filter);242 $the_list .= "\n\t\t<category domain=\"tag\"><![CDATA[$tag_name]]></category>\n";243 // forwards compatibility as above244 $the_list .= "\n\t\t<category domain=\"tag\" nicename=\"{$tag->slug}\"><![CDATA[$tag_name]]></category>\n";245 }246 247 244 echo $the_list; 248 245 }
Note: See TracChangeset
for help on using the changeset viewer.