Skip to content

Instantly share code, notes, and snippets.

@yayitswei
Created June 24, 2011 09:40
Show Gist options
  • Save yayitswei/1044503 to your computer and use it in GitHub Desktop.
Save yayitswei/1044503 to your computer and use it in GitHub Desktop.
function modify_permalinks($permalink_structure, $category_base, $tag_base){
global $wp_rewrite;
$permalink_structure = preg_replace('#/+#', '/', '/' . $permalink_structure);
$wp_rewrite->set_permalink_structure($permalink_structure);
$category_base = preg_replace('#/+#', '/', '/' . $category_base);
$wp_rewrite->set_category_base($category_base);
$tag_base = preg_replace('#/+#', '/', '/' . $tag_base);
$wp_rewrite->set_tag_base($tag_base);
update_option('rewrite_rules', FALSE);
$wp_rewrite->flush_rules($writable);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment