Google Sitemaps and WordPress 2.0
by Annika Backstrom in
Meta on 30 March 2006.
#WordPress
I've created a script to dump my blog post history into an XML file suitable for Google Sitemaps. Note that I consider any XML-building script that does not use XML creation tools to be a hack. This is a hack.
';
echo '';
// set upper limit to a sufficiently high number
$posts = get_posts('numberposts=32767&order=ASC&orderby=post_date');
// output all the posts
foreach($posts as $post): setup_postdata($post);
?>
';
Example: sitemap.php.
I also add a rewrite condition to my .htaccess file:
RewriteRule ^sitemap.xml$ sitemap.php [L]
Thus is born sitemap.xml.