get_category_link

Advertisement

Summery Summery

Retrieve category link URL.

Syntax Syntax

get_category_link( int|object $category )

Parameters Parameters

$category

(Required) Category ID or object.

Return Return

(string) Link on success, empty string if category does not exist.

Source Source

File: wp-includes/category-template.php

 */
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;

Advertisement

Changelog Changelog

Changelog
Version Description
1.0.0 Introduced.

See also See also

Advertisement

Leave a Reply