I have a wordpress site with lots of links in it. Every link has the extension ".html" (like <a href="https://example.com/about.html>
).
I like to add a filter which searches for the ".html" and replaces it with "" (<a href="https://example.com/about>
) on all pages.
I have tried to get this done with str_ireplace and the gettext filter.
function kb_rename_links( $kb_rename_item )
{
$kb_rename_item = str_ireplace( '.html', '', $kb_rename_item );
return $kb_rename_item;
}
add_filter( 'gettext', 'kb_rename_links' );
This snipped doesn't do the job (it works for plain text). I think the gettext filter isn't the right one for this job or even i need a action here. But i am to noobish to find the right one.
Thanks for your help