如何从自定义帖子类型获取自定义类别slug和ID?

我有一个自定义帖子类型。它具有自定义类别/分类法。它的名称是download_category, 即register_taxonomy(‘download_category’, …..

我需要知道自定义帖子类型的特定帖子的自定义类别ID和子句。

例如, 如果120是我的自定义帖子类型id, 那么我如何在download_category分类下获得自定义帖子类型的分类。请帮忙


#1


$ terms = get_the_terms(120, ‘download_category’);

print_r($ terms);

看到结果。


#2


通过使用

get_the_terms( 120, $taxonomy );

获取自定义帖子类型的分类

来源:

https://www.srcmini02.com/67118.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_36956.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
0
分享到:
没有账号? 忘记密码?