函数原型
has_term_meta( int $term_id ): array|false
函数描述
Gets all meta data, including meta IDs, for the given term ID.
是否弃用
未弃用
函数参数
-
$term_id
int
Required - Term ID.
函数返回值
array|false Array with meta data, or false when the meta table is not installed.
函数位置
File: wp-includes/taxonomy.php.
函数源码
function has_term_meta( $term_id ) {
$check = wp_check_term_meta_support_prefilter( null );
if ( null !== $check ) {
return $check;
}
global $wpdb;
return $wpdb->get_results( $wpdb->prepare( "SELECT meta_key, meta_value, meta_id, term_id FROM $wpdb->termmeta WHERE term_id = %d ORDER BY meta_key,meta_id", $term_id ), ARRAY_A );
}
源码链接
变更日志
| Version | Description |
|---|---|
| 4.9.0 | Introduced. |

