Created
January 16, 2013 05:54
-
-
Save ankitnetwork18/4544984 to your computer and use it in GitHub Desktop.
wordpress custom url rewrites
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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