Skip to content

Instantly share code, notes, and snippets.

@envex
Created May 17, 2012 18:09
Show Gist options
  • Save envex/2720618 to your computer and use it in GitHub Desktop.
Save envex/2720618 to your computer and use it in GitHub Desktop.
WordPress Custom Routes
/**
*
* Custom routes that we'd like to use
*
*/
function facet_rewrite_rules() {
add_rewrite_rule('job/edit/([0-9]+)?$', 'index.php?pagename=job/edit&job_id=$matches[1]', 'top' );
}
function facet_query_vars( $query_vars ) {
$query_vars[] = 'job_id';
return $query_vars;
}
// Do It
add_action( 'init', 'facet_rewrite_rules' );
add_filter( 'query_vars', 'facet_query_vars' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment