jbrinley / WP-Router

Routes paths to callback functions in WordPress
108 stars 27 forks source link

How to get query params and parameters in url? #26

Open falahatiali opened 4 years ago

falahatiali commented 4 years ago

examine we have this : 'path' => 'download/file/([0-9]+)/{name}',

how we can get these parameters in function ?


function create_routes_customs( $router ) { 
    $router->add_route('download', array(
        'path' => 'download/file/([0-9]+)/{name}',
        'access_callback' => true,      
        'page_callback' => 'download'
    ));
}

function download(){
//get params
}
jondcampbell commented 1 week ago

@falahatiali did you ever figure this out?