set_permalink_structure($permalink_structure);
}
if (!strpos($wp_rewrite->get_page_permastruct(), '.html')) {
$wp_rewrite->page_structure = $wp_rewrite->page_structure . '.html';
}
}
add_filter('user_trailingslashit', 'haita_rewriteURL_remove_slash', 66, 2);
function haita_rewriteURL_remove_slash($string, $type) {
global $wp_rewrite;
if ($wp_rewrite->using_permalinks() && $wp_rewrite->use_trailing_slashes == true && $type == 'page') {
return untrailingslashit($string);
} else {
return $string;
}
}
function haita_rewriteURL_activate() {
global $wp_rewrite;
haita_rewrite_permalink_structure();
$wp_rewrite->flush_rules();
}
function haita_rewriteURL_deactivate() {
global $wp_rewrite;
$permalink_structure = str_replace(".html", "/", get_option( 'permalink_structure' ));
$wp_rewrite->set_permalink_structure($permalink_structure);
$wp_rewrite->page_structure = str_replace(".html", "", $wp_rewrite->page_structure);
$wp_rewrite->flush_rules();
}
?>