Title: Arguments syntax, take 2
Last modified: April 16, 2021

---

# Arguments syntax, take 2

 *  [dch2018](https://wordpress.org/support/users/dch2018/)
 * (@dch2018)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/arguments-syntax-take-2/)
 * Hi John,
 * I wanted to post a working example of a WP Crontrol event with more than 1 argument.
 * This syntax worked for me…
 * `[{"offset-number":50,"max-number":60}]`
 * As you mentioned in the previous topic, [https://wordpress.org/support/topic/arguments-syntax/](https://wordpress.org/support/topic/arguments-syntax/),
   the WordPress docs do say that your hook will be passed multiple arguments, but
   my hook only ever gets passes one argument. This code works in my hook function:
 *     ```
       function mpp_run_cron_job($cron_args=array()) {
         $offset = $cron_args['offset-number'] ?? 0;
         $max_users_to_process = $cron_args['max-number'] ?? 1;
         $test_username = $cron_args['test-user'] ?? '';
         ...
       ```
   
 * Hope this helps others,
    David
    -  This topic was modified 5 years, 1 month ago by [dch2018](https://wordpress.org/support/users/dch2018/).

Viewing 1 replies (of 1 total)

 *  Plugin Author [John Blackbourn](https://wordpress.org/support/users/johnbillion/)
 * (@johnbillion)
 * WordPress Core Developer
 * [5 years, 1 month ago](https://wordpress.org/support/topic/arguments-syntax-take-2/#post-14328168)
 * Thanks for the post! Yes that’s the correct syntax for passing one parameter 
   to the callback, and that one parameter is an associative array of arguments.
 * I do want to improve the UI for this at some point, I’d been thinking of splitting
   the parameters input into one input for each parameter. Most of the time, most
   cron callback functions accept just one parameter. I can’t remember the last 
   time I wrote a cron callback that accepted more than one.

Viewing 1 replies (of 1 total)

The topic ‘Arguments syntax, take 2’ 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/)

 * 1 reply
 * 2 participants
 * Last reply from: [John Blackbourn](https://wordpress.org/support/users/johnbillion/)
 * Last activity: [5 years, 1 month ago](https://wordpress.org/support/topic/arguments-syntax-take-2/#post-14328168)
 * Status: not resolved