You're looking for the Rewrite API . It is used to customize the URLs so that you can fetch the values within your query in whatever form you need.
Example of Codex :
<?php
function custom_rewrite_rule() {
/**
* add_rewrite_tag() cria "tags" que podem ser acessadas pelo
* objeto de query padrão, usando get_query_var()
*/
add_rewrite_tag('%food%', '([^&]+)');
add_rewrite_tag('%variety%', '([^&]+)');
/**
* add_rewrite_rule() cria regras para traduzir as queries em URLs
* no formato desejado.
*
* A regra aqui cria a URL: http://example.com/nutrition/milkshakes/strawberry/
* transformada em food=milkshakes e variety=strawberry
*/
add_rewrite_rule('^nutrition/([^/]*)/([^/]*)/?','index.php?page_id=12&food=$matches[1]&variety=$matches[2]','top');
}
add_action('init', 'custom_rewrite_rule', 10, 0);
?>
Links:
add_rewrite_rule ()
add_rewrite_tag ()