• Resolved cag8f

    (@cag8f)


    Hello. Per your instructions in this post, I have added an external sitemap to my Yoast sitemap index by adding a custom PHP function to my functions.php file. My Yoast sitemap index now displays an entry for my external sitemap–the entry includes the sitemap location and its “Last Modified” date. My question is about the “Last Modified” date. I realize that, in my custom PHP function, I can explicitly set a date for the “Last Modified” field, e.g.

    $sitemap_custom_items = '
    <sitemap>
    <loc>http://www.example.com/external-sitemap-1.xml</loc>
    <lastmod>2017-05-22T23:12:27+00:00</lastmod>
    </sitemap>';

    But is there a way to ensure the “Last Modified” field is dynamically populated with a value, rather than having to explicitly set it? For example, is there a way to ensure the “Last Modified” field is automatically populated with the last modified date attached to the XML file (if one exists)?

    Thanks.

Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘XML sitemaps and their “Last Modified” date’ is closed to new replies.