I’ve noticed some URL’s in our sitemap weren’t generated correctly.
Some of them had the site_url missing, which causes errors in Google’s Webmaster Tools and probably other parsers too.
This happens for both post type and images.
Where a url should have
I’ve solved this in the class-sitemaps.php
At line +-500, replace:
$output .= "\t\t<loc>".$url['loc']."</loc>\n";
if ( strpos($url['loc'], 'http') === false ) $output .= "\t\t<loc>".home_url($url['loc'])."</loc>\n"; else $output .= "\t\t<loc>".$url['loc']."</loc>\n";
The same goes for the image:loc a bit below.
I’m not sure what causes this, might be with the statement at line 338:
if ( strpos($src, 'http') !== 0 )
should be compared to false instead 0 ?
- The topic ‘[Plugin: WordPress SEO by Yoast] Invalid url loc in sitemaps’ is closed to new replies.