WordPress at a glance

get_category_link() WP 1.0

Retrieve category link URL.

Works based on: get_term_link()

No Hooks.

Return

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

Usage

get_category_link( $category );
$category(int/object) (required)
Category ID or object.

Notes

  • See: get_term_link()

Changelog

Since 1.0.0 Introduced.

Code of get category link: wp-includes/category-template.php WP 5.2.2

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

Related Functions

From category: Categories

No comments
    Hello, !     Log In . Register