Title: WP List Categories Function
Last modified: September 1, 2016

---

# WP List Categories Function

 *  [michelleoli3](https://wordpress.org/support/users/michelleoli3/)
 * (@michelleoli3)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/wp-list-categories-function/)
 * Hi there.
 * I am currently running a multisite.
    I need to show categories from Site A onto
   Site B. I manage that with the following code:
 *     ```
       <?php switch_to_blog(10);
       wp_list_categories(array (
       'orderby' => 'name',
       'child_of' => '193',
       'style' => '',
       'separator' => '<br /><br />',
       ));
       restore_current_blog();?>
       ```
   
 * Is there a way that when I click on a category that I can get it to open in a
   new window? I don’t want my visitors to leave Site A all together.
 * Thanks in advance!

Viewing 1 replies (of 1 total)

 *  [Mladen.i](https://wordpress.org/support/users/mladeni/)
 * (@mladeni)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/wp-list-categories-function/#post-7584402)
 * Hello,
 * You could try something like this:
 *     ```
       <?php
       switch_to_blog(10);
       $cats = wp_list_categories(array (
           'orderby' => 'name',
           'child_of' => '193',
           'style' => '',
           'separator' => '<br /><br />',
           'echo' => 0
       ));
       echo str_replace('<a','<a target="_blank"', $cats);
       restore_current_blog();
       ?>
       ```
   
 * Hope that helps.

Viewing 1 replies (of 1 total)

The topic ‘WP List Categories Function’ is closed to new replies.

## Tags

 * [wp_list_categories()](https://wordpress.org/support/topic-tag/wp_list_categories/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [Mladen.i](https://wordpress.org/support/users/mladeni/)
 * Last activity: [9 years, 8 months ago](https://wordpress.org/support/topic/wp-list-categories-function/#post-7584402)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
