admin管理员组文章数量:1392007
I have custom post type of jobs and in this post type I have two custom taxonomies. For job post I selected few terms from both these taxonomies in admin panel but when I tried to access these on front end using get_post_meta
it is displaying these terms as empty.
I have two taxonomies (city, industry). I am getting city terms like this
[_job_city] => Array
(
[0] =>
)
I am getting industry terms like this
[_company_industry] => Array
(
[0] => s:1:"1";
)
Any suggestion ?
I have custom post type of jobs and in this post type I have two custom taxonomies. For job post I selected few terms from both these taxonomies in admin panel but when I tried to access these on front end using get_post_meta
it is displaying these terms as empty.
I have two taxonomies (city, industry). I am getting city terms like this
[_job_city] => Array
(
[0] =>
)
I am getting industry terms like this
[_company_industry] => Array
(
[0] => s:1:"1";
)
Any suggestion ?
Share Improve this question edited Feb 7, 2020 at 17:09 wplearner asked Feb 6, 2020 at 23:11 wplearnerwplearner 4892 gold badges9 silver badges27 bronze badges 11 | Show 6 more comments1 Answer
Reset to default 1Instead of get_post_meta
now I am using wp_get_post_terms
function to access job post terms and it is working for me. It is working correctly for both these taxonomies.
本文标签: custom post typesgetpostmeta returns empty array for terms
版权声明:本文标题:custom post types - get_post_meta returns empty array for terms 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744768762a2624206.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
get_terms()
and notget_post_meta()
.. – Sally CJ Commented Feb 6, 2020 at 23:16