-
Hi,
it seems that the Rank Math is throwing a Fatal Error on some sitemaps like pages, posts etc. when the “Include Images from the ACF Fields” option is turned on in the Rank Math Sitemap General Settings.
Please note that the site is using the latest version of ACF Pro and Rank Math.Here is the error that is thrown by Rank Math:
Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /some/path/sites/example.com/public/wp-content/plugins/seo-by-rank-math-pro/includes/modules/acf/class-acf.php:159 Stack trace: #0 /some/path/sites/example.com/public/wp-content/plugins/seo-by-rank-math-pro/includes/modules/acf/class-acf.php(90): RankMathProACFACF->get_sub_fields_content() #1 /some/path/sites/example.com/public/wp-includes/class-wp-hook.php(307): RankMathProACFACF->parse_html_images() #2 /some/path/sites/example.com/public/wp-includes/plugin.php(233): WP_Hook->apply_filters() #3 /some/path/sites/example.com/public/wp-content/plugins/seo-by-rank-math/includes/traits/class-hooker.php(102): apply_filters_ref_array() #4 /some/path/sites/example.com/public/wp-content/plugins/seo-by-rank-math/includes/modules/sitemap/class-image-parser.php(191): RankMathSitemapImage_Parser->do_filter() #5 /some/path/sites/example.com/public/wp-content/plugins/seo-by-rank-math/includes/modules/sitemap/class-image-parser.php(119): RankMathSitemapImage_Parser->get_post_images() #6 /some/path/sites/example.com/public/wp-content/plugins/seo-by-rank-math/includes/modules/sitemap/providers/class-post-type.php(447): RankMathSitemapImage_Parser->get_images() #7 /some/path/sites/example.com/public/wp-content/plugins/seo-by-rank-math/includes/modules/sitemap/providers/class-post-type.php(197): RankMathSitemapProvidersPost_Type->get_url() #8 /some/path/sites/example.com/public/wp-content/plugins/seo-by-rank-math/includes/modules/sitemap/class-generator.php(169): RankMathSitemapProvidersPost_Type->get_sitemap_links() #9 /some/path/sites/example.com/public/wp-content/plugins/seo-by-rank-math/includes/modules/sitemap/class-generator.php(135): RankMathSitemapGenerator->build_sitemap() #10 /some/path/sites/example.com/public/wp-content/plugins/seo-by-rank-math/includes/modules/sitemap/class-sitemap-xml.php(160): RankMathSitemapGenerator->get_output() #11 /some/path/sites/example.com/public/wp-content/plugins/seo-by-rank-math/includes/modules/sitemap/class-sitemap-xml.php(147): RankMathSitemapSitemap_XML->build_sitemap() #12 /some/path/sites/example.com/public/wp-content/plugins/seo-by-rank-math/includes/modules/sitemap/class-sitemap-xml.php(85): RankMathSitemapSitemap_XML->has_sitemap_in_cache() #13 /some/path/sites/example.com/public/wp-content/plugins/seo-by-rank-math/includes/modules/sitemap/class-sitemap-xml.php(75): RankMathSitemapSitemap_XML->output() #14 /some/path/sites/example.com/public/wp-content/plugins/seo-by-rank-math/includes/modules/sitemap/class-router.php(79): RankMathSitemapSitemap_XML->__construct() #15 /some/path/sites/example.com/public/wp-includes/class-wp-hook.php(307): RankMathSitemapRouter->request_sitemap() #16 /some/path/sites/example.com/public/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters() #17 /some/path/sites/example.com/public/wp-includes/plugin.php(522): WP_Hook->do_action() #18 /some/path/sites/example.com/public/wp-includes/class-wp-query.php(1103): do_action_ref_array() #19 /some/path/sites/example.com/public/wp-includes/class-wp-query.php(1791): WP_Query->parse_query() #20 /some/path/sites/example.com/public/wp-includes/class-wp-query.php(3542): WP_Query->get_posts() #21 /some/path/sites/example.com/public/wp-includes/class-wp.php(637): WP_Query->query() #22 /some/path/sites/example.com/public/wp-includes/class-wp.php(760): WP->query_posts() #23 /some/path/sites/example.com/public/wp-includes/functions.php(1310): WP->main() #24 /some/path/sites/example.com/public/wp-blog-header.php(16): wp() #25 /some/path/sites/example.com/public/index.php(17): require('...') #26 {main} thrown in /some/path/sites/example.com/public/wp-content/plugins/seo-by-rank-math-pro/includes/modules/acf/class-acf.php on line 159
I’ve also included a screen recording demonstration in the sensitive data section.
Please note that this issue was present in the Rank Math code (Link: https://support.rankmath.com/ticket/fatal-error-warning-on-rank-math-while-viewing-sitemap/) which was fixed previously but it seems that issue is back again. So @pratik-d if you can look into this and resolve this little bug, it would be really helpful.
The ticket ‘Sitemap throwing Fatal Error when “Include Images from the ACF Fields” is ON’ is closed to new replies.