WordPress.org

Support

Support » Plugins and Hacks » Google Sitemap plugin fix

Google Sitemap plugin fix

  • I use Arne’s Sitemap Plugin (http://www.arnebrachhold.de/redir/sitemap-home/) on many of my sites, most of which are mainly posts, not pages. However for a recent project, the site was mostly pages, multiple levels deep.

    After getting errors from Google about my sitemap, I found that all the entries for pages had only the pagename in them – none of the parent path info was being included.

    After a bunch of debugging, I found that the post_parent attribute was left out of the SQL query in the sitemap plugin. To fix this, I simply added “, post_parent” to line 1566 of the plugin. Now that the data is retrieved, the WordPress permalink functions work as expected.

    So Line 1566 changed from:
    $sql="SELECT ID ,post_modified, post_date, post_status, post_author, post_name

    to
    $sql="SELECT ID ,post_modified, post_date, post_status, post_author, post_name, post_parent

    [bbPress took out the single quotes from the post – be sure to INCLUDE them so the post_parent part looks like the other fields in the query]

    I let Arne know of this simple fix, but figured I’d post it here in case others are wondering why their subpages are failing in their sitemap.xml file when using this plugin.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Google Sitemap plugin fix’ is closed to new replies.
Skip to toolbar