Title: How do I &#8216;linkify&#8217; this function?
Last modified: August 19, 2016

---

# How do I ‘linkify’ this function?

 *  [Pete](https://wordpress.org/support/users/perthmetro/)
 * (@perthmetro)
 * [16 years, 7 months ago](https://wordpress.org/support/topic/how-do-i-linkify-this-function/)
 * This piece of code displays the category as text… but I’d like it to display 
   as a link to that category… any help would be greatly appreciated. Thanks. Pete
   xxx
 *     ```
       <?php
       foreach((get_the_category()) as $childcat) {
       if (cat_is_ancestor_of(40, $childcat)) {
       echo $childcat->cat_name;
       }}
       ?>
       ```
   

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [Pete](https://wordpress.org/support/users/perthmetro/)
 * (@perthmetro)
 * [16 years, 5 months ago](https://wordpress.org/support/topic/how-do-i-linkify-this-function/#post-1266574)
 * bump
 *  [Edward Caissie](https://wordpress.org/support/users/cais/)
 * (@cais)
 * [16 years, 5 months ago](https://wordpress.org/support/topic/how-do-i-linkify-this-function/#post-1266575)
 * Have you looked at this function: [http://codex.wordpress.org/Function_Reference/get_category_link](http://codex.wordpress.org/Function_Reference/get_category_link)

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘How do I ‘linkify’ this function?’ is closed to new replies.

## Tags

 * [category](https://wordpress.org/support/topic-tag/category/)
 * [function](https://wordpress.org/support/topic-tag/function/)
 * [link](https://wordpress.org/support/topic-tag/link/)
 * [parent](https://wordpress.org/support/topic-tag/parent/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [Edward Caissie](https://wordpress.org/support/users/cais/)
 * Last activity: [16 years, 5 months ago](https://wordpress.org/support/topic/how-do-i-linkify-this-function/#post-1266575)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
