get_term_children

SummerySummery

Merge all term children into a single array of their IDs.

Syntax

get_term_children( int $term_id, string $taxonomy )

DescriptionDescription

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

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

ParametersParameters

$term_id

(int) (Required) ID of Term to get children.

$taxonomy

(string) (Required) Taxonomy Name.

ReturnReturn

(array|WP_Error) List of Term IDs. WP_Error returned if $taxonomy does not exist.

SourceSource

File: wp-includes/taxonomy.php


			

ChangelogChangelog

Changelog
Version Description
2.3.0 Introduced.
Scroll to Top