• Resolved mkunzelman

    (@mkunzelman)


    I have a plugin that pulls in data that we want to make a sitemap for. It seems to work when initializing the plugin / clearing the cache, but NOT when the sitemaps are regenerated due to a site content update. We get this error:

    [17-Oct-2023 18:51:54 UTC] PHP Fatal error:  Uncaught TypeError: call_user_func_array(): Argument #1 ($callback) must be a valid callback, function “products_sitemap_generate” not found or invalid function name in /var/www/com_fabtechexpo/wp-includes/class-wp-hook.php:310

    Basically taken from your github example:

    function products_sitemap_register() {
    global $wpseo_sitemaps;
    if (isset($wpseo_sitemaps) && !empty($wpseo_sitemaps)) {
    $wpseo_sitemaps->register_sitemap(“products”, “products_sitemap_generate”);
    }
    }
    add_action(“init”, “products_sitemap_register”);

    The ‘products_sitemap_generate’ function is inside another plugin. Thoughts or help appreciated.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Maybellyne

    (@maybellyne)

    Hello @mkunzelman,

    Thanks for reaching out about your sitemap, but what you are trying to achieve is unclear. Do you have an external sitemap you want to add to the Yoast SEO sitemap index?

    Thread Starter mkunzelman

    (@mkunzelman)

    Yes, we are trying to include a programatically generated sitemap. It works as expected when we initially enable the sitemap functionality of the sitemap plugin for yoast, but errors when the sitemaps are updated on a content change. I believe it can’t find our function to run it on a content update, but can when it’s run on the yoast sitemap plugin startup.

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

The topic ‘Custom sitemap from plugin data’ is closed to new replies.