Function: get_term_parents_list

get_term_parents_list( integer $term_id, string $taxonomy, string | array $args )

Retrieve term parents with separator.

Shortcut: gtpl

You can use above key combination to trigger the associated snippet for this function in the WordPress Snippets for Visual Studio Code extension. You can also use this shortcut to search for this function on this website.

Parameters

Name Type(s) Default Value Description
$term_id integer

Term ID.

$taxonomy string

Taxonomy name.

$args string | array array()

{ Array of optional arguments.

@type string $format    Use term names or slugs for display. Accepts 'name' or 'slug'.
                        Default 'name'.
@type string $separator Separator for between the terms. Default '/'.
@type bool   $link      Whether to format as a link. Default true.
@type bool   $inclusive Include the term to get the parents for. Default true.

}

Returns

string | WP_Error

A list of term parents on success, WP_Error or empty string on failure.

WordPress Developer Newsletter

Stay informed of new chapter releases, important WordPress API updates and more.