The error happens because the filter callback (shapeSpace_disable_sitemap_post_meta()
) expects to receive two parameters ($args
and $post_type
) and yet you call add_filter()
without setting the fourth parameter to 2
.
So to solve the problem:
// Replace this:
add_filter('wp_sitemaps_posts_query_args', 'shapeSpace_disable_sitemap_post_meta');
// with this one:
add_filter('wp_sitemaps_posts_query_args', 'shapeSpace_disable_sitemap_post_meta', 10, 2);