Per aggiungere l’estensione .html alle pagine in WordPress, bisogna metter mano al nostro codice nel file functions.php aggiungendo quanto segue:
add_action('init', 'html_page_permalink', -1);
function html_page_permalink() {
global $wp_rewrite;
if ( !strpos($wp_rewrite->get_page_permastruct(), '.html')){
$wp_rewrite->page_structure = $wp_rewrite->page_structure . '.html';
}
}
add_filter('user_trailingslashit', 'no_page_slash',66,2);
function no_page_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;
}
}
Fatto ciò andiamo in Impostazioni -> Permalink e aggiorniamo clicchiamo su OK.
Se desideriamo modificare solo l’estensione dei posti in .html, basterà andare in Impostazioni -> Permalink e in “struttura personalizzata”, digitare /%postname%.html








