wppaste
WordPress

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.
$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

Used by · 2

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.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 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 docblock
1.2.0
Introduced.from the docblock

About this page

Parsed data
Generated from the wordpress-develop 6.9.7 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.