Add .htm extention to a custom taxonomy

I need to add ‘.htm’ to all my urls on a new site – client requires that, as I am converting a old static site into WP.

(I use Remove Taxonomy Base Slug to hide the slug of my custom taxonomy “topic” url.)

Read More

Now, I have a ‘.htm’ extension on all pages, post etc. Now, I only need to add this ‘.htm’ extension to my custom taxonomy archives. Does anyone have an idea of how this can be done?

I tried this:

/* Add Tax extension .htm */

add_action('init', 'add_html_ext_to_custom_post_type_taxonomies');
function add_html_ext_to_custom_post_type_taxonomies() {
    add_rewrite_rule('^topic/([^/]+).htm', 'index.php?topic=$matches[1]', 'top');
} 

which I found here
Add .html extension to custom post type taxonomies

That gave me no change at all, and I did remember to flush permalinks.

Thanks 🙂

Related posts

Leave a Reply