How to Add .Html Extension to WordPress Post URLs (Permalinks)?

If you want to add a .html extension to your WordPress post URLs (permalinks), there are a few things you need to do.

First, you’ll need to enable the file_upload_max_filesize plugin. This will allow WordPress to handle larger files.

Second, you’ll need to upload your files to the WordPress media folder. This is located at wp-content/uploads/.

Third, you’ll need to add a .html extension to the files you upload.

To do this, use the following file_extension_prepend() function in your functions.php file:.

function file_extension_prepend(file_name, file_extension) {

if (!file_exists(file_name)) {

if (file_exists(wp_config_dir_path(). ‘/files/’ . file_extension)) {

wp_config_dir_path().

file_extension . ‘/’ . basename(file_name);.

}

else {

wp_config_dir_path(). file_extension;

Finally, you’ll need to update your permalinks to use the .html extension instead of the .

php extension. To do this, use the following function in your functions.

function update_post_permalinks(post_id) {

$GLOBALS[‘post_type’] = ‘post';

$GLOBALS[‘post_status’] = ‘publish';

$GLOBALS[‘post_date’] = date(‘Y-m-d H:i:s’);

$GLOBALS[‘post_name’] = post_title;

$GLOBALS[‘post_author’] = post_author_name;

$GLOBALS[‘post_category’] = post_category_name;

$GLOBALS[‘post_mime_type’] = ‘text/html';

$GLOBALS[‘post_content’] = esc_html();

$GLOBALS[‘paged’] = (int) get_the_post_meta(post_id, ‘paged’);

$GLOBALS[‘post_type_name’] = $GLOBALS[‘post_type’];

update_post_meta(post_id, ‘paged’, $GLOBALS[‘paged’]);

$GLOBALS[‘post_status_name’] = $GLOBALS[‘post_status’];

update_post_meta(post_id, ‘post_status_name’, $GLOBALS[‘post_status_name’]);

$GLOBALS[‘post_date_name’] = $GLOBALS[‘post_date’];

update_post_meta(post_id, ‘post_date_name’, $GLOBALS[‘post_date_name’]);

$GLOBALS[‘post_name_length’] = (int) get_the_post_meta(post_id, ‘name_length’);

$GLOBALS[‘post_name_format’] = ‘sn_';

update_post_meta(post_id, ‘name_format’, $GLOBALS[‘post_name_format’]);

$GLOBALS[‘post_category_name_length’] = (int) get_the_post_meta(post_id, ‘category_name_length’);

$GLOBALS[‘post_category_name_format’] = ‘cn_';

update_post_meta(post_id, ‘category_name_format’, $GLOBALS[‘post_category_name_format’]);

$GLOBALS[‘post_mime_type_name’] = $GLOBALS[‘post_mime_type’];

update_post_meta(post_id, ‘mime_type_name’, $GLOBALS[‘post_mime_type_name’]);

if ( ! is_multisite() ) {

$GLOBALS[‘post_site_id’] = get_the_ID();

$GLOBALS[‘post_site_id’] = get_post_site_id();

update_post_meta(post_id, ‘post_site_id’, $GLOBALS[‘post_site_id’]);

$GLOBALS[‘post_status’] = $GLOBALS[‘post_.