A WordPress-centric search engine for devs and theme authors



get_category_link ›

Since1.0.0
Deprecatedn/a
get_category_link ( $category )
Parameters:
  • (int|object) $category Category ID or object.
    Required: Yes
See:
Returns:
  • (string) Link on success, empty string if category does not exist.
Defined at:
Codex:

Retrieve category link URL.



Source

function get_category_link( $category ) {
	if ( ! is_object( $category ) )
		$category = (int) $category;

	$category = get_term_link( $category, 'category' );

	if ( is_wp_error( $category ) )
		return '';

	return $category;
}