Title: args in function
Last modified: April 4, 2017

---

# args in function

 *  Resolved [isarcowboy](https://wordpress.org/support/users/isarcowboy/)
 * (@isarcowboy)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/args-in-function/)
 * Hey John,
 * could you give me an example how to grab args (array) in a function?
    I have 
   added an array of args / attributes like [“mail-address”, 10] to my hook. How
   do I grab these args in my function? Best regards, Chris

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

 *  Plugin Author [John Blackbourn](https://wordpress.org/support/users/johnbillion/)
 * (@johnbillion)
 * WordPress Core Developer
 * [9 years, 1 month ago](https://wordpress.org/support/topic/args-in-function/#post-8991473)
 * Hi Chris,
 * These args get passed as individual parameters to your callback function. Here’s
   an example callback for your cron event:
 *     ```
       add_action( 'my_action', function( $type, $number ) {
           echo $type;   // mail-address
           echo $number; // 10
       }, 10, 2 );
       ```
   
 * Remember you’ll need to include the correct number for `$accepted_args` in `add_action()`,
   which in this case is `2`.
 * John
    -  This reply was modified 9 years, 1 month ago by [John Blackbourn](https://wordpress.org/support/users/johnbillion/).
    -  This reply was modified 9 years, 1 month ago by [John Blackbourn](https://wordpress.org/support/users/johnbillion/).
 *  Thread Starter [isarcowboy](https://wordpress.org/support/users/isarcowboy/)
 * (@isarcowboy)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/args-in-function/#post-8991602)
 * You made my day! excellent.

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

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

 * ![](https://ps.w.org/wp-crontrol/assets/icon.svg?rev=3539529)
 * [WP Crontrol](https://wordpress.org/plugins/wp-crontrol/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-crontrol/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-crontrol/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-crontrol/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-crontrol/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-crontrol/reviews/)

## Tags

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

 * 2 replies
 * 2 participants
 * Last reply from: [isarcowboy](https://wordpress.org/support/users/isarcowboy/)
 * Last activity: [9 years, 1 month ago](https://wordpress.org/support/topic/args-in-function/#post-8991602)
 * Status: resolved