Skip to content

Instantly share code, notes, and snippets.

@ankitnetwork18
Created January 16, 2013 05:54
Show Gist options
  • Save ankitnetwork18/4544984 to your computer and use it in GitHub Desktop.
Save ankitnetwork18/4544984 to your computer and use it in GitHub Desktop.
wordpress custom url rewrites
<?php
/***********************************************************************************************************/
/********************* WRITE OUR CUSTOM REWRITE RULES IN WORDPRESS *****************************************/
/***********************************************************************************************************/
add_action( 'init', 'add_custom_rewrite_rules' );
function add_custom_rewrite_rules() {
global $wp_rewrite;
$new_rules = array(
"blog/city/([^/]+)/([^/]+)/?" => "index.php?city_tags=\$matches[2]"
);
$wp_rewrite->extra_rules_top += $new_rules;
/*echo "<pre>";
print_r($wp_rewrite);
echo "</pre>";
exit;*/
}
/***********************************************************************************************************/
/***********************************************************************************************************/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment