get_term_children()获取一个分类的子分类

目录

描述

译文

将所有term子辈整合成一个单独数组。

该函数为递归函数,将$term的所有子辈整合到同一个数组中。仅对分层级的分类法有效。

若$taxonomy中没有$term则返回空数组。

原文

Merge all term children into a single array.

This recursive function will merge all of the children of $term into the same array. Only useful for taxonomies which are hierarchical.

Will return an empty array if $term does not exist in $taxonomy.

get_term_children() 描述

用法

<?php get_term_children$term$taxonomy ?>

get_term_children() 用法

参数

$term

(string) (必填) ID of Term to get children

默认值: None

$taxonomy

(string) (必填) Taxonomy Name

默认值: None

get_term_children() 参数

返回值

(array|WP_Error) 

Array of Term IDs. WP_Error returned if $taxonomy does not exist

get_term_children() 返回值

示例

A Basic Example

Used to get an array of children taxonomies and write them out with links in an unordered list.

This would return something like.

get_term_children() 示例

注意

  • 使用到: $wpdb
  • 使用到: _get_term_hierarchy()
  • 使用到: get_term_children Used to get the children of both $taxonomy and the parent $term

get_term_children() 注意

历史

添加于 版本: 2.3.0

get_term_children() 历史

源文件

get_term_children() 函数的代码位于 wp-includes/taxonomy.php.

get_term_children() 源文件

相关