Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Rewritetax {
- function Rewritetax() {
- add_action( 'generate_rewrite_rules', array(&$this, 'rewriteRules') );
- add_action( 'init', array(&$this, 'flushRules') );
- }
- /**
- * flush rules
- */
- function flushRules(){
- global $wp_rewrite;
- $wp_rewrite->flush_rules();
- }
- /**
- * Rewrite rule for taxonomy
- */
- function rewriteRules( $wp_rewrite ) {
- $new_rules = array(
- 'http://mytaxonomy.domain.com/([^/]+)?$' => 'index.php?mytaxonomy='. $wp_rewrite->preg_index(1),
- );
- $wp_rewrite->rules = $new_rules + $wp_rewrite->rules;
- }
- }
- new Rewritetax();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement