给定术语对象的输出术语元XML标记。

原型

wxr_term_meta( WP_Term $term )

参数

$term (WP_Term) (Required) 术语对象。

源文件

路径:wp-admin/includes/export.php

<?php
...
	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 ) {
			/**
			 * Filters 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( "tt<wp:termmeta>nttt<wp:meta_key>%s</wp:meta_key>nttt<wp:meta_value>%s</wp:meta_value>ntt</wp:termmeta>n", wxr_cdata( $meta->meta_key ), wxr_cdata( $meta->meta_value ) );
			}
		}
	}
...
?>

其他

英文文档:https://developer.wordpress.org/reference/functions/wxr_term_meta/