get_category_parents( int $category_id, bool $link = false, string $separator = '/', bool $nicename = false, array $deprecated = array() ): string|WP_Error
- Since
- 1.2.0, 4.8.0
- Source
wp-includes/category-template.php:47
Retrieves category parents with separator.
Parameters
$category_idint- Category ID.
$linkbooloptional- Whether to format with link. Default false.Default:
false $separatorstringoptional- How to separate categories. Default '/'.Default:
'/' $nicenamebooloptional- Whether to use nice name for display. Default false.Default:
false $deprecatedarrayoptional- Not used.Default:
array()
Return
string|WP_Error- A list of category parents on success, WP_Error on failure.
Uses · 2
- _deprecated_argument()Marks a function argument as deprecated and inform when it has been used.
- get_term_parents_list()Retrieves term parents with separator.
Used by · 2
- get_permalink()Retrieves the full permalink for the current post or post ID.
- get_the_category_list()Retrieves category list for a post in either HTML list or custom format.
Source
function get_category_parents( $category_id, $link = false, $separator = '/', $nicename = false, $deprecated = array() ) { if ( ! empty( $deprecated ) ) { _deprecated_argument( __FUNCTION__, '4.8.0' ); } $format = $nicename ? 'slug' : 'name'; $args = array( 'separator' => $separator, 'link' => $link, 'format' => $format, ); return get_term_parents_list( $category_id, 'category', $args );}History
Introduced in 1.2.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
4.8.0
The
$visited parameter was deprecated and renamed to $deprecated.from the docblock1.2.0
Introduced.from the docblock
About this page
- Parsed data
- Generated from the wordpress-develop 6.8.8 tag, from
src/wp-includes/category-template.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.