Remove trailing slash on void elements

I’d like to remove trailing slashes from void elements in my markup. I know I can do this with Javascript but I’d prefer to do it at source (PHP) esp for the img tag. Could anyone point me to the relevant source file(s) please?

For those interested:

What is a void element?

Trailing slash has no effect

Trailing slash interacts badly with unquoted attribute values

Perhaps you can adapt the Minify HTML Plugin to your needs or use it as a source of inspiration.

Thanks for the tip - I’ll check it out and report back.

IMO it’s much better to fix unquoted attributes than a closing slashes. Just my 2 cents

1 Like