Title: Arguments Syntax?
Last modified: November 22, 2019

---

# Arguments Syntax?

 *  Resolved [Gerdski](https://wordpress.org/support/users/gerdski/)
 * (@gerdski)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/arguments-syntax/)
 * Hello,
 * I have no clue on how arguments work in this plugin.
 * I am being told
    “use a JSON-encoded array, like [25], [“asdf”] or [“i”,”want”,
   25,”cakes”]”, but how to use this? Is there a practical example?
 * Let’s say I want to pass the parameter howmanycakes=25…what must i put in the
   arguments box?
 * Something like [“howmanycakes”,25] ?
    Or [“howmanycakes=25”] ? or something else?
 * Thanks!

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

 *  Plugin Author [John Blackbourn](https://wordpress.org/support/users/johnbillion/)
 * (@johnbillion)
 * WordPress Core Developer
 * [6 years, 4 months ago](https://wordpress.org/support/topic/arguments-syntax/#post-12163506)
 * Thanks for the message. This isn’t an easy thing to figure out because you also
   need to be aware of how the WP-Cron functions in WordPress core accept arguments.
 * The args parameter represents all the parameters passed to the callback function.
   Each item in the array is a successive parameter. Example:
 * `[1,2,3]` is the equivalent of calling `my_function( 1, 2, 3 )`.
 * If your callback function’s first argument is an associative array then you’ll
   need something like this:
 * `[{"howmanycakes":25}]` which is the equivalent of calling `my_function( array('
   howmanycakes' => 25 ) )`
 * Hope this helps. I’ve added a TODO for myself to improve this documentation in
   the plugin.
 *  Thread Starter [Gerdski](https://wordpress.org/support/users/gerdski/)
 * (@gerdski)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/arguments-syntax/#post-12166473)
 * Ah, ok. So in order to set howmanycakes=25, i must enter [25] in the parameter
   box for this one cronjob, and then set my_function like this:
 * my_function ($howmanycakes) {
    echo $howmanycakes; }
 * which should echo 25 if called by my cronjob…right?
 *  Plugin Author [John Blackbourn](https://wordpress.org/support/users/johnbillion/)
 * (@johnbillion)
 * WordPress Core Developer
 * [6 years, 4 months ago](https://wordpress.org/support/topic/arguments-syntax/#post-12166825)
 * Correct!
 *  Thread Starter [Gerdski](https://wordpress.org/support/users/gerdski/)
 * (@gerdski)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/arguments-syntax/#post-12171340)
 * Great. Works now.
 * I’d suggest putting 1 or 2 lines of explanation to the input field description
   of the plugin. It is easy to understand but hard to guess. 🙂
 * Thanks!

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

The topic ‘Arguments Syntax?’ is closed to new replies.

 * ![](https://ps.w.org/wp-crontrol/assets/icon.svg?rev=2997335)
 * [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

 * [arguments](https://wordpress.org/support/topic-tag/arguments/)
 * [array](https://wordpress.org/support/topic-tag/array/)
 * [cron](https://wordpress.org/support/topic-tag/cron/)
 * [encoded](https://wordpress.org/support/topic-tag/encoded/)
 * [json](https://wordpress.org/support/topic-tag/json/)

 * 4 replies
 * 2 participants
 * Last reply from: [Gerdski](https://wordpress.org/support/users/gerdski/)
 * Last activity: [6 years, 4 months ago](https://wordpress.org/support/topic/arguments-syntax/#post-12171340)
 * Status: resolved