Uma área de pesquisa sobre o WordPress para devs e autores do tema



get_category_parents ›

Desde1.2.0
Obsoleton/a
get_category_parents ( $id, $link = false, $separator = '/', $nicename = false, $deprecated = array() )
Parâmetros: (5)
  • (int) $id Category ID.
    Required: Yes
  • (bool) $link Optional, default is false. Whether to format with link.
    Required: No
    Padrão: false
  • (string) $separator Optional, default is '/'. How to separate categories.
    Required: No
    Padrão: '/'
  • (bool) $nicename Optional, default is false. Whether to use nice name for display.
    Required: No
    Padrão: false
  • (array) $deprecated Not used.
    Required: No
    Padrão: array()
Retorna:
  • (string|WP_Error) A list of category parents on success, WP_Error on failure.
Definido em:
Codex:
Log de mudanças:
  • 4.8.0 The ` $visited` parameter was deprecated and renamed to ` $deprecated`.

Retrieve category parents with separator.



Fonte

function get_category_parents( $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( $id, 'category', $args );
}