Custom sitemap from plugin data
-
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:310Basically 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.
The topic ‘Custom sitemap from plugin data’ is closed to new replies.