Title: Problem with parameter in register route method
Last modified: August 31, 2016

---

# Problem with parameter in register route method

 *  Resolved [fersamp](https://wordpress.org/support/users/fersamp/)
 * (@fersamp)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/problem-with-parameter-in-register-route-method-1/)
 * Hi,
    I have problem with register_routes(): I have to do a query to get some 
   thing but I don’t manage to pass a date to my function.
 * This is my route registration:
 *     ```
       register_rest_route( $this->namespace, '/' . $this->rest_base . '/todayEvents', array(
       		array(
       		'methods'         => WP_REST_Server::READABLE,
       		'callback'        => array( $this, 'getTodayEvents' ),
       		'args'            => array(
       							 'posts_per_page'     => 4,
       							 'offset'     => 1,
       							 'filter'     => date("Y-m-d")
       							),
       		),
       		'schema'          => array( $this, 'get_public_item_schema' ),
       		) );
       ```
   
 * In getTodayEvents($request) method I need to retrieve the date passed but I don’t
   know how.
 * In my function
    $dateFilter = $request[‘filter’];
 * $dateFilter is empty.
 * I need to use the same function and passing different params because I have to
   filter my results by different date, so I think it’s better to use a generic 
   function and passing different arguments.
 * Thank you
 * [https://wordpress.org/plugins/rest-api/](https://wordpress.org/plugins/rest-api/)

Viewing 1 replies (of 1 total)

 *  Plugin Author [Daniel Bachhuber](https://wordpress.org/support/users/danielbachhuber/)
 * (@danielbachhuber)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/problem-with-parameter-in-register-route-method-1/#post-7075518)
 * I’ve [already replied](https://wordpress.org/support/topic/problem-with-parameter-in-register-route-method?replies=3#post-8040129)
   on the other thread you’ve created.

Viewing 1 replies (of 1 total)

The topic ‘Problem with parameter in register route method’ is closed to new replies.

 * ![](https://ps.w.org/rest-api/assets/icon-256x256.png?rev=1346297)
 * [WordPress REST API (Version 2)](https://wordpress.org/plugins/rest-api/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/rest-api/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/rest-api/)
 * [Active Topics](https://wordpress.org/support/plugin/rest-api/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/rest-api/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/rest-api/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Daniel Bachhuber](https://wordpress.org/support/users/danielbachhuber/)
 * Last activity: [10 years, 6 months ago](https://wordpress.org/support/topic/problem-with-parameter-in-register-route-method-1/#post-7075518)
 * Status: resolved