最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

custom taxonomy - Retrieve the child terms by having the parent's information

programmeradmin0浏览0评论

I have access through a series of joins to the terms table, in order to bring out all the taxonomies that are associated with the post if I wanted to.

with this code:

<?php
echo "{$r->term_id}";
echo "{$r->name}";
?>

i have:

22
Sito Web

Sito Web it s a children taxonomy servizi_pro

how to retrive only the children about: Sito Web

i want only the childern from: $r->name

schema:

servizi_pro
|
|_ Sito Web
   |
   |_ 1600

i want have 1600

update:

if I do this it returns me all those associated with all the posts instead of having a foreach loop I would like it to return me specific for all the posts

$terms = get_terms( array( 'taxonomy' => 'servizi_pro', 'parent' => $r->term_id ) );
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){
    echo '<ul>';
    foreach ( $terms as $term ) {
        echo '<li>' . $term->name . '</li>';

    }
    echo '</ul>';
}

if I do so it returns me all those associated with all the posts instead of having a foreach loop I would like it to return to me specific to each post.

Show me the third level of taxonomy associated with each single post for the searched taxonomy "sito-web"

发布评论

评论列表(0)

  1. 暂无评论