WordPress.org

Ready to get started?Download WordPress

Forums

Google XML Sitemap for Videos
Here is the code for Automatic Daily Regenerate (1 post)

  1. a1wsn
    Member
    Posted 1 year ago #

    Currently the plugin only creates a new video sitemap when you manually click the 'generate' button, but I needed my video sitemap to be regenerated automatically each day.

    I did offer to pay the plugin developer to create the code but I didn't receive a reply from him, so I paid another developer to create the code, and the new automatic function is working perfectly for me now so I'd like to share it with you.

    I did already send this new code to the plugin developer so he can add it to the official plugin, but I haven't received a response yet (after 10 days) so I'm just going to post a link to it here.

    First a few notes about the new automatic functionality:

    Note that it is coded to check the date of the current sitemap file every hour, and if the file is older than 24 hours then it will be updated automatically.

    I believe this hourly check is better than simply setting a wordpress scheduled event once per day, because WordPress is not always reliable with scheduled tasks. I have often seen scheduled posts that miss their schedule (that is why I also need to use a 'Missed Schedule' plugin to publish scheduled posts that WordPress accidentally missed).

    So instead of just making a scheduled event once per day to update the video sitemap (which WordPress might miss) I instead made it an hourly check so it's more reliable. It will only update the sitemap if it is older than 24 hours to reduce possible serverload from updating too often.

    Also the 'include video duration' setting is now stored in the plugin settings and used for the automatic daily generation.

    You can get the code from the link below, and then you'll need to use this new code to replace the current plugin code. You can either replace the current video-sitemap.php using FTP, or simply copy-paste the code using the WordPress Plugin Editor.

    Here is the new code:
    http://pastebin.com/8U4vfTND

    If you at all worried about using unofficial plugin code, I encourage you to compare the original plugin code and the new code, you will see there is only a few new functions to make the automatic generation take place, definitely nothing malicious hidden in there :)

    I hope this helps others as much as it has helped me. You're welcome! And thanks also to the plugin developer, I hope he will add this to the official code eventually.

    http://wordpress.org/extend/plugins/xml-sitemaps-for-videos/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.