wpseek.com
A WordPress-centric search engine for devs and theme authors



get_category_link › WordPress Function

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:

Retrieves category link URL.



Source

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

	$category = get_term_link( $category );

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

	return $category;
}