Skip to content

Instantly share code, notes, and snippets.

@anthonybudd
Last active June 9, 2018 19:13
Show Gist options
  • Save anthonybudd/5529e4524a3e694abb745032a9ec3055 to your computer and use it in GitHub Desktop.
Save anthonybudd/5529e4524a3e694abb745032a9ec3055 to your computer and use it in GitHub Desktop.
<?php
WP_Route::get('/', function(){
return "Hello World."
});
WP_Route::get('/flights', 'flights'); // flights()
WP_Route::post('/flights/{flight}', 'singleFlight'); // singleFlight($flight)
WP_Route::put('/flights/{flight}/book/{date}', 'bookFlight');
WP_Route::delete('/flights/{flight}/delete', 'deleteFlight');
WP_Route::any('/flights/{flight}', 'Class@staticMethod');
WP_Route::any('/flights/{flight}', array('Class', 'staticMethod'));
WP_Route::patch('/flights/{flight}', array($object, 'method'));
WP_Route::match(['get', 'post'], 'flights/{flight}/confirm', 'confirmFlight');
WP_Route::redirect('/from/here', '/to/here', 301);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment