Title: Array in shortcode function
Last modified: August 31, 2016

---

# Array in shortcode function

 *  [zzuum](https://wordpress.org/support/users/zzuum/)
 * (@zzuum)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/array-in-shortcode-function/)
 * Hello,
    I have one array. like this :
 * $test[‘1′,’2′,’3’];
 * and now I want to create shortcode that will return me that array. And that array
   i get outside of shortcode function.
 * $test[‘1′,’2′,’3’];
 * var_dump($arrt);
    function movies_func($arrt) { return ‘test’; } add_shortcode(‘
   movies’, ‘movies_func’);
 * I need to push that array in shortcode fucntion and then return it, and show 
   on page, with shortcode. Is there any way to do that? And i don’t want to create
   my array in that function.

Viewing 1 replies (of 1 total)

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/array-in-shortcode-function/#post-7271470)
 * Shortcodes only handle string data, not arrays or objects. You could serialize
   and unserialize the array before and after the shortcode to make it into a string,
   but this would only be feasible with shortcodes invoked with `do_shortcode()`.
   It will not work in normal content since you cannot have PHP code in content.

Viewing 1 replies (of 1 total)

The topic ‘Array in shortcode function’ is closed to new replies.

## Tags

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

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 1 reply
 * 2 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [10 years, 1 month ago](https://wordpress.org/support/topic/array-in-shortcode-function/#post-7271470)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
