wpseek.com
Bazujące na WordPress narzędzie wyszukiwania dla deweloperów i twórców motywów.



get_category_parents › WordPress Function

Od1.2.0
Przestarzałyn/a
get_category_parents ( $category_id, $link = false, $separator = '/', $nicename = false, $deprecated = array() )
Parametry: (5)
  • (int) $category_id Category ID.
    Wymagane: Tak
  • (bool) $link Optional. Whether to format with link. Default false.
    Wymagane: Nie
    Domyślny: false
  • (string) $separator Optional. How to separate categories. Default '/'.
    Wymagane: Nie
    Domyślny: '/'
  • (bool) $nicename Optional. Whether to use nice name for display. Default false.
    Wymagane: Nie
    Domyślny: false
  • (array) $deprecated Not used.
    Wymagane: Nie
    Domyślny: array()
Powrót:
  • (string|WP_Error) A list of category parents on success, WP_Error on failure.
Zdefiniowane na:
Codex:
Dziennik zmian:
  • 4.8.0

Retrieves category parents with separator.



Źródło

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