Title: add_shortcode question, arrays
Last modified: August 19, 2016

---

# add_shortcode question, arrays

 *  [consumedesign](https://wordpress.org/support/users/consumedesign/)
 * (@consumedesign)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/add_shortcode-question-arrays/)
 * I am trying to make it as simple for a client to add a shortcode to their text
   area in the admin and it will produce a Paypal button with options (didn’t see
   any plugins that would help and are simple). I have
 *     ```
       function paypal_func( $atts ) {
       	echo '<pre>';print_r($atts);echo '</pre>';
       }
       add_shortcode( 'pp', 'paypal_func' );
       ```
   
 * and
 *     ```
       [pp button="XXXXBUTTONCODEXXXX" option="Sizes: Small, Medium, Large, Extra Large, XXL" option="Type: Male, Female"]
       ```
   
 * the result is:
 *     ```
       Array
       (
           [button] => XXXXBUTTONCODEXXXX
           [option] => Type: Male, Female
       )
       ```
   
 * I was hoping that it would result in the option as an array instead of overriding
   it with the 2nd one. Is there anyway to pull the data and have it result in an
   array so it would be:
 *     ```
       Array
       (
           [button] => XXXXBUTTONCODEXXXX
           [option] => Array
               (
                   [0] => Sizes: Small, Medium, Large, Extra Large, XXL
                   [1] => Type: Male, Female
               )
   
       )
       ```
   
 * I doubt there is but was hopeful maybe someone came across this problem before.
   
   thanks.

The topic ‘add_shortcode question, arrays’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [consumedesign](https://wordpress.org/support/users/consumedesign/)
 * Last activity: [15 years, 2 months ago](https://wordpress.org/support/topic/add_shortcode-question-arrays/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
