wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



get_category_parents › WordPress Function

Seit1.2.0
Veraltetn/v
get_category_parents ( $category_id, $link = false, $separator = '/', $nicename = false, $deprecated = array() )
Parameter: (5)
  • (int) $category_id Category ID.
    Erforderlich: Ja
  • (bool) $link Optional. Whether to format with link. Default false.
    Erforderlich: Nein
    Standard: false
  • (string) $separator Optional. How to separate categories. Default '/'.
    Erforderlich: Nein
    Standard: '/'
  • (bool) $nicename Optional. Whether to use nice name for display. Default false.
    Erforderlich: Nein
    Standard: false
  • (array) $deprecated Not used.
    Erforderlich: Nein
    Standard: array()
Gibt zurück:
  • (string|WP_Error) A list of category parents on success, WP_Error on failure.
Definiert in:
Codex:
Changelog:
  • 4.8.0

Retrieves category parents with separator.



Quellcode

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 );
}