Codex tools: Log in
Languages: English • 日本語 • (Add your language)
Contents |
Returns the correct url for a given Category ID.
<?php get_category_link( $category_id ); ?>
<?php
// Get the ID of a given category
$category_id = get_cat_ID( 'Category Name' );
// Get the URL of this category
$category_link = get_category_link( $category_id );
?>
<!-- Print a link to this category -->
<a href="<?php echo esc_url( $category_link ); ?>" title="Category Name">Category Name</a>
Since: 1.0.0
get_category_link() is located in wp-includes/category-template.php.
Categories: the_category(), the_category_rss(), single_cat_title(), category_description(), wp_dropdown_categories(), wp_list_categories(), get_the_category(), get_the_category_by_ID(), get_category_by_slug(), get_the_category_list(), get_category_parents(), get_category_link(), is_category(), in_category()