admin管理员组文章数量:1332377
I have registered custom post taxonomy with rewrited name:
register_taxonomy('behold_gallery-albums-subject', 'behold_gallery',array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'show_admin_column' => true,
'rewrite' => array( 'slug' => 'kategorie-galerii', 'with_front' => true ),
'update_count_callback' => '_update_post_term_count',
'query_var' => true,
));
so name of my custom taxonomy is 'behold_gallery-albums-subject' but is rewrited to 'kategorie-galerii'.
If I want to get name of this taxonomy, I can use this
$postsTaxonomy = get_sub_field('archive__post-choose-taxonomy'); // ACF
$postsTerm = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
$postsTerm_id = $postsTerm->term_id;
$PostsTaxName = get_taxonomy($postsTaxonomy)->labels->name;
but how can I get this rewrited name, not the 'original'?
Thanks!
I have registered custom post taxonomy with rewrited name:
register_taxonomy('behold_gallery-albums-subject', 'behold_gallery',array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'show_admin_column' => true,
'rewrite' => array( 'slug' => 'kategorie-galerii', 'with_front' => true ),
'update_count_callback' => '_update_post_term_count',
'query_var' => true,
));
so name of my custom taxonomy is 'behold_gallery-albums-subject' but is rewrited to 'kategorie-galerii'.
If I want to get name of this taxonomy, I can use this
$postsTaxonomy = get_sub_field('archive__post-choose-taxonomy'); // ACF
$postsTerm = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
$postsTerm_id = $postsTerm->term_id;
$PostsTaxName = get_taxonomy($postsTaxonomy)->labels->name;
but how can I get this rewrited name, not the 'original'?
Thanks!
Share Improve this question asked Jun 30, 2020 at 15:33 D_PD_P 1531 gold badge3 silver badges12 bronze badges1 Answer
Reset to default 0Do you mean just get the rewritten slug? From the docs it looks like you should be able to do:
$rewrite_name = get_taxonomy($postsTaxonomy)->rewrite['slug']
Or do you mean something else?
本文标签: custom post typesHow to get rewrited name of cusom taxonomy
版权声明:本文标题:custom post types - How to get rewrited name of cusom taxonomy? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742305484a2449829.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论