Jetpack: WP Rocket breaks Jetpack 4.8

Created on 4 Apr 2017  路  9Comments  路  Source: Automattic/jetpack

After updating Jetpack, we noticed the entire Jetpack Admin appears to be failing to load. It appears to be because WP Rocket is calling a function that no longer exists:

jetpack_sitemap_uri();

Full Error from log:

[Tue Apr 04 18:52:29.964330 2017] [:error] [pid 12851] [client 74.7.222.157:50990] PHP Fatal error: Uncaught Error: Call to undefined function jetpack_sitemap_uri() in /nas/content/live/agfmedia/wp-content/plugins/wp-rocket/inc/3rd-party/jetpack.php:30\nStack trace:\n#0 [internal function]: __rocket_add_jetpack_sitemap(Array)\n#1 /nas/content/live/agfmedia/wp-includes/class-wp-hook.php(298): call_user_func_array('__rocket_add_je...', Array)\n#2 /nas/content/live/agfmedia/wp-includes/plugin.php(203): WP_Hook->apply_filters(Array, Array)\n#3 /nas/content/live/agfmedia/wp-content/plugins/wp-rocket/inc/functions/bots.php(127): apply_filters('rocket_sitemap_...', Array)\n#4 /nas/content/live/agfmedia/wp-content/plugins/wp-rocket/inc/functions/bots.php(107): run_rocket_sitemap_preload()\n#5 /nas/content/live/agfmedia/wp-content/plugins/wp-rocket/inc/3rd-party/hosting/wpengine.php(27): run_rocket_preload_cache('cache-preload')\n#6 [internal function]: __rocket_run_rocket_bot_after_wpengine('')\n#7 /nas/content/live/agfmedia/wp-includes/class-wp-hook.php(298): call_user_func_array('__rocket_run_ro...', Array)\n#8 /nas/conten in /nas/content/live/agfmedia/wp-content/plugins/wp-rocket/inc/3rd-party/jetpack.php on line 30, referer: https://www.agfmedia.com/wp-admin/admin.php?page=wpengine-common
Sitemaps [Pri] BLOCKER [Type] Bug

Most helpful comment

Hi there,

Jonathan from WP Rocket here.

We've just released the 2.9.11 which checks if the jetpack_sitemap_uri function exists before to use it.

When the function will be deprecated, let us know which new one we must use or if there is anything else we can do on our side.

All 9 comments

For reference, here is the snippet that triggers the issue:

        add_filter( 'rocket_sitemap_preload_list', '__rocket_add_jetpack_sitemap' );
        function __rocket_add_jetpack_sitemap( $sitemaps ) {
            if ( get_rocket_option( 'jetpack_xml_sitemap', false ) ) {
                $sitemaps['jetpack'] = jetpack_sitemap_uri();
            }

            return $sitemaps;
        }

WP Rocket checks is Jetpack is active and if the Sitemaps module is enabled before to apply thats code.

Bug introduced in #5503

It doesn't look like #5503 removed the jetpack_sitemap_uri function?

@georgestephanis It did, but since it's a large diff it's harder to search when looking at the PR. If you expand the diff in 918f0d31151c1b3ca448230804f75b36b720971b you'll be able to see.

Ah-ha! Tricksy UI.

Hi @bhubbard thanks for the report.
Can you please test the PR #6904 and see if it solves the issue for you?

Almost, still getting an error, but this time for the argument:

[Tue Apr 04 20:35:27.140377 2017] [:error] [pid 24660] [client 74.7.222.157:19874] PHP Warning: Missing argument 1 for jetpack_sitemap_uri(), called in /nas/content/live/agfmedia/wp-content/plugins/wp-rocket/inc/3rd-party/jetpack.php on line 30 and defined in /nas/content/live/agfmedia/wp-content/plugins/jetpack/modules/sitemaps/sitemaps.php on line 500, referer: https://www.agfmedia.com/wp-admin/admin.php?page=wpengine-common

Thanks @bhubbard! Should be good to go now, I've added sitemap.xml as the default for the argument, so it works like in the previous sitemaps version.

This should also be fixed in the next version of WP Rocket, 2.9.11, scheduled to be released soon. Kudos @GeekPress for the quick fix!

Hi there,

Jonathan from WP Rocket here.

We've just released the 2.9.11 which checks if the jetpack_sitemap_uri function exists before to use it.

When the function will be deprecated, let us know which new one we must use or if there is anything else we can do on our side.

Was this page helpful?
0 / 5 - 0 ratings