diff --git a/src/wp-admin/includes/export.php b/src/wp-admin/includes/export.php index 4b18c9c0a3..3aa172f93a 100644 --- a/src/wp-admin/includes/export.php +++ b/src/wp-admin/includes/export.php @@ -182,7 +182,7 @@ function export_wp( $args = array() ) { if ( empty( $category->name ) ) return; - echo '' . wxr_cdata( $category->name ) . ''; + echo '' . wxr_cdata( $category->name ) . "\n"; } /** @@ -196,7 +196,7 @@ function export_wp( $args = array() ) { if ( empty( $category->description ) ) return; - echo '' . wxr_cdata( $category->description ) . ''; + echo '' . wxr_cdata( $category->description ) . "\n"; } /** @@ -210,7 +210,7 @@ function export_wp( $args = array() ) { if ( empty( $tag->name ) ) return; - echo '' . wxr_cdata( $tag->name ) . ''; + echo '' . wxr_cdata( $tag->name ) . "\n"; } /** @@ -224,7 +224,7 @@ function export_wp( $args = array() ) { if ( empty( $tag->description ) ) return; - echo '' . wxr_cdata( $tag->description ) . ''; + echo '' . wxr_cdata( $tag->description ) . "\n"; } /** @@ -238,7 +238,7 @@ function export_wp( $args = array() ) { if ( empty( $term->name ) ) return; - echo '' . wxr_cdata( $term->name ) . ''; + echo '' . wxr_cdata( $term->name ) . "\n"; } /** @@ -252,7 +252,38 @@ function export_wp( $args = array() ) { if ( empty( $term->description ) ) return; - echo '' . wxr_cdata( $term->description ) . ''; + echo "\t\t" . wxr_cdata( $term->description ) . "\n"; + } + + /** + * Output termmeta XML tags for a given term object. + * + * @since 4.6.0 + * + * @param WP_Term $term Term object. + */ + function wxr_term_meta( $term ) { + global $wpdb; + + $termmeta = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->termmeta WHERE term_id = %d", $term->term_id ) ); + + foreach ( $termmeta as $meta ) { + /** + * Filter whether to selectively skip term meta used for WXR exports. + * + * Returning a truthy value to the filter will skip the current meta + * object from being exported. + * + * @since 4.6.0 + * + * @param bool $skip Whether to skip the current piece of term meta. Default false. + * @param string $meta_key Current meta key. + * @param object $meta Current meta object. + */ + if ( ! apply_filters( 'wxr_export_skip_termmeta', false, $meta->meta_key, $meta ) ) { + printf( "\t\t\n\t\t\t%s\n\t\t\t%s\n\t\t\n", wxr_cdata( $meta->meta_key ), wxr_cdata( $meta->meta_value ) ); + } + } } /** @@ -386,13 +417,34 @@ function export_wp( $args = array() ) { - term_id ); ?>slug ); ?>parent ? $cats[$c->parent]->slug : '' ); ?> + + term_id ); ?> + slug ); ?> + parent ? $cats[$c->parent]->slug : '' ); ?> + + - term_id ); ?>slug ); ?> + + term_id ); ?> + slug ); ?> + + - term_id ); ?>taxonomy ); ?>slug ); ?>parent ? $terms[$t->parent]->slug : '' ); ?> + + term_id ); ?> + taxonomy ); ?> + slug ); ?> + parent ? $terms[$t->parent]->slug : '' ); ?> + +