functions – Bad value crossorigin for attribute crossorigin on element link

Question

‘m trying to get a perfect score on W3C, but I have one last error that I can’t get to remove. It’s been 2 weeks since I’m trying a lot of things and nothing works (I’m on wordpress but I would like not to create a wordpress child theme)

The error is : Bad value crossorigin for attribute crossorigin on element link.

link rel="preload" href="mysite/police.woff2?3oibrk" as="font" type="font/woff2" crossorigin="crossorigin"

Obviously the problem is crossorigin=”crossorigin” so I would like to remove the =”crossorigin” part so I can get rid of this error.

That’s what I’ve tried to add (and a lot of other things but I didn’t keep track of it) :

 function replaceCross($the_content){
        $replace = array(
            '<link>="crossorigin"</>' => '',
        );
        $the_content = str_replace(array_keys($replace), $replace, $the_content);
        return $the_content;
    }

    add_filter('the_content', 'replaceCross',998);

Thanks in advance! (a lot)

0
Fredd 2 weeks 2022-11-15T13:56:00-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse