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...

  • Click the check mark to mark the answer as The Solution. – fuxia 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); ?>
  • 1
    Then mark the answer as the answer, use the checkmark (✔). – fuxia Jun 11 '12 at 14:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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