How to fix the WordPress SEO sitemap bug caused by NextGEN Gallery

If you use WordPress SEO with NextGEN gallery and have submitted a WPSEO generated sitemap to Google Webmaster tools than you have most likely run into an error with your images not being indexed properly. After some debugging I discovered that this was related to how NextGEN gallery incorrectly adds images to the WPSEO generated sitemap using a filter that the author of WPSEO (@yoast) added to his plugin.

The file located in wp-content/plugins/nextgen-gallery/lib/sitemap.php contains the bug. I supplied the NextGEN gallery support team with this patch file on July 6th (which still works as of the writing of this post). If you would prefer to simply overwrite the existing file with a patched version of the file, you can download this patched file (you will need to remove the .txt extension before uploading and overwriting the NextGEN bugged version).

Unfortunately, they’ve just been too busy to add my patch to their code.

Comments

  1. Thanks for sharing your fix. I just want to confirm that we will be adding the fix to an update. But as mentioned, there are a lot of bugs in the plugin that were there before we acquired it. So we’re trying to get to as many as we can. We are doing due-diligence for each bug fix, so it takes time.

    • Sounds good Scott! Thanks for keeping us in the loop. Until then, the fix is public so people can deal with it until you guys can get it added to the code base.

  2. Thanks for the solution – I switched back to using another plugin for xml sitemaps but will try wp seo plugin agan.

  3. http://Scott says

    Just wanted to let you know the plugin has been updated with the fix for the WordPress SEO error.

  4. Thanks Scott, I’ll keep an eye out for it.

  5. Thank you for sharing the patch file Lew but unfortunatly it doesn’t seem to work any more.
    I installed the NextGEN yesterday (29th of August) and everything seemed to be ok untill I noticed in Google Webmaster Tools that the sitemap returned a 404. A bit weird as Scott announced the bug being fixed.
    I uploaded your patch file but I’m still getting a 404 on the sitemaps.

    Any idea would be welcome :-)

    Cheers,
    Paul

  6. For the time being, I uninstalled the NextGEN plugin, changed the settings in WP SEO plugin – check the two Tags lines in XML Sitemap – Exclude taxonomies and save. Then uncheck these lines again and save (sitemap should be functioning again) – and resubmitted the sitemap in Google Webmaster Tools.

  7. Paul, Yoast just updated the WordPress SEO plugin… might be related??? I do not seem to be seeing any 404 errors in Google Webmaster Tools.

    Oh, and there is a WSOD bug in the next version of WPSEO, if he doesn’t fix it before you update it, you’ll need to edit line 441 of admin/class-admin.php and remove the “s” from update_options(). See this ticket: http://wordpress.org/support/topic/plugin-wordpress-seo-by-yoast-wordpress-seo-caused-my-site-to-display-just-white

  8. Hi Lew,

    thanks for letting me know. I just updated the plugin and was looking for the solution :-). Will this new update of WPSEO going to fix the NextGEN gallery issue as well?

  9. http://Scott says

    Paul,

    Did you clear any cache plugins that you might have? Update your permalinks as a precaution? If so, please head over to the support forum and share your plugins that are active, what WP, NextGEN and WPSEO plugins you are using: http://wordpress.org/support/plugin/nextgen-gallery

  10. http://Scott says

    Yoast just released 2 updates within the last day. Paul, please make sure you’re completely up to date on his plugin. I know the NextGEN development team hasn’t had a chance to test the latest WPSEO update yet because of how new it is.

  11. Hi Scott,

    I’ve updated the WPSEO plugin twice because of an error in the first update and everything seems to be ok now. I don’t get any error any more on the sitemaps. Thank you for all the help.

  12. http://Scott says

    Welcome Paul

  13. Although I get no errors, I also am getting no images indexed nor showing up in sitemaps.

    • Hey Craig, I see the images in my XML file source… I see them in your XML source as well (for the domain you listed on your comment). The images themselves do not appear, but they are referenced in the code.

  14. Hello, for this site http://www.ajax-wallpapers.nl we use the next gen gallery for some time. We notice that the images used in the gallery itself, are not indexed and do not show up in the search engines.

    We do not use the Yoast SEO plugin but the premium plugin from iThemes. Is there any for this?

    Thx,
    Annie

    • Hi Annie, What plugin are you using from iThemes? I am not aware of any SEO or sitemap plugins from them.

  15. Hi Lew,

    Thx for your quick respons!
    I am using the Builder SEO plugin Beta 0.1.12

    Further more I use the XML Sitemap Generator voor WordPress 3.2.9 .
    We insert the meta description and title tags, yet we notice that only the images in the Next Gen gallery dont show up in the search results. Tagged images outside the NG gallery show up nicely in the search results.

    I read in your blog there were fixes made with the Yoast SEO plugin, but it seems there are conficts with the Builder SEO plugin as well?

    Thx,
    Annie

    • Hey Annie, Unfortunately I don’t have access to any of the Builder tools at iThemes. You’d probably have better luck if you opened a support ticket with them. You can send them a link to this post if they need any more info. I know a couple of developers over there, too.

  16. Hey Lew,

    Thx, I understand you dont have access to iThemes.
    I am testing now and if I dont find the solution I will contact Scott for it seems to be a bug in the NGG plugin i.c.m. with a SEO plugin so it seems.

    I noticed I dont have the permalinks on in the NGG gallery, so I will try if that makes any difference.

    Kind regards,
    Annie