File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -265,7 +265,7 @@ function link_tag(
265265
266266 $ link .= 'rel=" ' . $ rel . '" ' ;
267267
268- if ($ type !== '' && $ rel !== 'canonical ' ) {
268+ if ($ type !== '' && $ rel !== 'canonical ' && $ hreflang === '' ) {
269269 $ link .= 'type=" ' . $ type . '" ' ;
270270 }
271271
Original file line number Diff line number Diff line change @@ -367,6 +367,18 @@ public function testLinkTagArray()
367367 $ this ->assertSame ($ expected , link_tag ($ parms ));
368368 }
369369
370+ public function testLinkTagArrayHreflang ()
371+ {
372+ $ tag = link_tag ([
373+ 'href ' => 'https://example.com/en ' ,
374+ 'rel ' => 'alternate ' ,
375+ 'hreflang ' => 'x-default ' ,
376+ ]);
377+
378+ $ expected = '<link href="https://example.com/en" hreflang="x-default" rel="alternate" /> ' ;
379+ $ this ->assertSame ($ expected , $ tag );
380+ }
381+
370382 public function testDocType ()
371383 {
372384 $ target = 'html4-strict ' ;
You can’t perform that action at this time.
0 commit comments