Title: Return array from wp_get_archives()
Last modified: August 19, 2016

---

# Return array from wp_get_archives()

 *  Resolved [generalsalt](https://wordpress.org/support/users/generalsalt/)
 * (@generalsalt)
 * [16 years, 2 months ago](https://wordpress.org/support/topic/return-array-from-wp_get_archives/)
 * For get_categories() and wp_get_all_tags() I am returning an array passing that
   array to a function that creates columns.
 * I really need to keep with the same layout with wp_get_archives(). I want to 
   display archives (per month) in a column format.
 * wp_get_archives() doesn’t seem to offer a way to return results as an array. 
   So that is my question, is there a way to make that happen? Many thanks!

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

 *  [Mark / t31os](https://wordpress.org/support/users/t31os_/)
 * (@t31os_)
 * [16 years, 2 months ago](https://wordpress.org/support/topic/return-array-from-wp_get_archives/#post-1441903)
 *     ```
       <?php
       $archi = wp_get_archives( 'echo=0' );
       $archi = explode( '</li>' , $archi );
       $links = array();
       foreach( $archi as $link ) {
       	$link = str_replace( array( '<li>' , "\n" , "\t" , "\s" ), '' , $link );
       	if( '' != $link )
       		$links[] = $link;
       	else
       		continue;
       }
       print '<pre>';
       print_r( $links );
       print '</pre>';
       ?>
       ```
   
 * Printing at the end is to show you the array, do as you will..
 *  Thread Starter [generalsalt](https://wordpress.org/support/users/generalsalt/)
 * (@generalsalt)
 * [16 years, 2 months ago](https://wordpress.org/support/topic/return-array-from-wp_get_archives/#post-1441948)
 * thank you!!
 *  [Mark / t31os](https://wordpress.org/support/users/t31os_/)
 * (@t31os_)
 * [16 years, 2 months ago](https://wordpress.org/support/topic/return-array-from-wp_get_archives/#post-1441951)
 * You’re welcome… 😉

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

The topic ‘Return array from wp_get_archives()’ is closed to new replies.

## Tags

 * [array](https://wordpress.org/support/topic-tag/array/)
 * [loop](https://wordpress.org/support/topic-tag/loop/)
 * [wp_get_archives](https://wordpress.org/support/topic-tag/wp_get_archives/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 2 participants
 * Last reply from: [Mark / t31os](https://wordpress.org/support/users/t31os_/)
 * Last activity: [16 years, 2 months ago](https://wordpress.org/support/topic/return-array-from-wp_get_archives/#post-1441951)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
