Created
January 17, 2011 16:52
-
-
Save westi/783084 to your computer and use it in GitHub Desktop.
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 | |
function cwws_deactivate() { | |
// to undo - Holy crap! | |
global $wp_rewrite; | |
// Remove the 'json' endpoint. | |
$old_ends = $wp_rewrite->endpoints; | |
$wp_rewrite->endpoints = array(); | |
foreach ( $old_ends as $_end ) { | |
list( $_places, $_name ) = $_end; | |
if ( 'json' != $_name ) | |
$wp_rewrite->endpoints[] = $_end; | |
} | |
// Remove the CPT rules | |
// Remove the Tag | |
$position = array_search("%people%", $wp_rewrite->rewritecode); | |
unset( $wp_rewrite->rewritecode[$position] ); | |
unset( $wp_rewrite->rewritereplace[$position] ); | |
unset( $wp_rewrite->queryreplace[$position] ); | |
// Remove the archive rules | |
unset( $wp_rewrite->extra_rules_top["people/?$"] ); | |
$feeds = '(' . trim( implode( '|', $wp_rewrite->feeds ) ) . ')'; | |
unset( $wp_rewrite->extra_rules_top["people/feed/$feeds/?$"] ); | |
unset( $wp_rewrite->extra_rules_top["people/$feeds/?$"] ); | |
unset( $wp_rewrite->extra_rules_top["people/{$wp_rewrite->pagination_base}/([0-9]{1,})/?$"] ); | |
$wp_rewrite->flush_rules(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment