WordPress按术语ID获取分类名称

有没有一种方法可以仅使用术语id来提取分类法名称?就像我有一个term_id一样, 我不知道它属于哪个分类法, 因此也需要获取它所属的分类法名称。可以吗

谢谢!


#1


你可以使用get_term():https://codex.wordpress.org/Function_Reference/get_term

$term = get_term( $term_id );
echo $term->taxonomy;

来源:

https://www.srcmini02.com/66722.html

微信公众号
手机浏览(小程序)

Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(): Failed to enable crypto in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_40349.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
0
分享到:
没有账号? 忘记密码?