WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to display the category Name by using category ID with link to category page (out side the loop).

here is my code...

<a href="<?php get_category_link('23'); ?>"><?php echo get_the_category_by_id(23); ?></a>

it's ok, but only think is it's go to home page... instead of category page... something missing... which i'hv not understand...

share|improve this question
Click the check mark to mark the answer as The Solution. – toscho Dec 18 '12 at 11:47

You need to echo your link:

<a href="<?php echo esc_url( get_category_link('23') ); ?>">
    <?php echo get_the_category_by_id(23); ?>
share|improve this answer
Thanks Eugene it's working..... – user16967 Jun 11 '12 at 14:43
Then mark the answer as the answer, use the checkmark (✔). – toscho Jun 11 '12 at 14:47

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.