Languages: English • 한국어 • 日本語 (Add your language)
Returns the correct url for a given Category ID.
In a Plugin or Theme, it can be used as early as the setup_theme Action. Any earlier usage, including plugins_loaded, generates a Fatal Error.
<?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
.