WPIntell

Source evidence

Fatal error on WP 4.9

WP-Cron Status Checker · support · 2019-11-19T09:00:00+00:00

mixedsentiment
highseverity
0.94relevance
2replies
Evidence linked to opportunitycommercial context

Proof Health

Open evidence

Commercial opportunities need traceable source links before they are treated as build-worthy.

7 / 35 rows with source links

20.0% of this page's analysis has direct source links.

0 build-decision rows missing links

0 rows here require auditable proof before promotion.

28 rows with no attached evidence

0 rows have source counts but still need direct links.

Conversation

support
Mansi Shah resolved
Hi, Getting following fatal error on sites with WP v4.9: PHP message: PHP Fatal error: Uncaught Error: Call to undefined function wp_get_ready_cron_jobs() in /wp-content/plugins/wp-cron-status-checker/inc/cron-checker.php:100 Stack trace: #0 /wp-content/plugins/wp-cron-status-checker/inc/cron-checker.php(175): wcsc_monitor_runs() #1 /wp-includes/class-wp-hook.php(286): wcsc_init_cron_monitor('') #2 /wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(NULL, Array) #3 /wp-includes/plugin.php(453): WP_Hook->do_action(Array) #4 /wp-settings.php(450): do_action('init') #5 /wp-config.php(111): require_once('/...') #6 /wp-load.php(37): require_once('/...') #7 /wp-cron.php(33): require_once('/...') #8 {main} thrown in /wp-content/plugins/wp-cron-status-checker/in" while reading response header from upstream Works well on sites with WP v5.1+. My question, will this plugin not work on lower WP versions? Ah sorry about that. I’ll have a fix in the next update. eta: 2 weeks or so. For now you can copy the source code for wp_get_ready_cron_jobs() and paste it into inc/cron-checker.php function wp_get_ready_cron_jobs() { /** * Filter to preflight or hijack retrieving ready cron jobs. * * Returning an array will short-circuit the normal retrieval of ready * cron jobs, causing the function to return the filtered value instead. * * @since 5.1.0 * * @param null|array $pre Array of ready cron tasks to return instead. Default null * to continue using results from _get_cron_array(). */ $pre = apply_filters( 'pre_get_ready_cron_jobs', null ); if ( null !== $pre ) { return $pre; } $crons = _get_cron_array(); if ( false === $crons ) { return array(); } $gmt_time = microtime( true ); $keys = array_keys( $crons ); if ( isset( $keys[0] ) && $keys[0] > $gmt_time ) { return array(); } $results = array(); foreach ( $crons as $timestamp => $cronhooks ) { if ( $timestamp > $gmt_time ) { break; } $results[ $timestamp ] = $cronhooks; } return $results; } also found here: https://developer.wordpress.org/reference/functions/wp_get_ready_cron_jobs/ When you update to the next version this will be overwritten, but it will also have the fix in it so you won’t have to worry. I’ve ran this plugin on WP v4.9 and it works with this code. version 1.2 is out and should fix this issue. Thank you for reporting it.

Comments

2 shown
webheadcoder 2019-11-19T20:46:00+00:00

Ah sorry about that. I’ll have a fix in the next update. eta: 2 weeks or so. For now you can copy the source code for wp_get_ready_cron_jobs() and paste it into inc/cron-checker.php function wp_get_ready_cron_jobs() { /** * Filter to preflight or hijack retrieving ready cron jobs. * * Returning an array will short-circuit the normal retrieval of ready * cron jobs, causing the function to return the filtered value instead. * * @since 5.1.0 * * @param null|array $pre Array of ready cron tasks to return instead. Default null * to continue using results from _get_cron_array(). */ $pre = apply_filters( 'pre_get_ready_cron_jobs', null ); if ( null !== $pre ) { return $pre; } $crons = _get_cron_array(); if ( false === $crons ) { return array(); } $gmt_time = microtime( true ); $keys = array_keys( $crons ); if ( isset( $keys[0] ) && $keys[0] > $gmt_time ) { return array(); } $results = array(); foreach ( $crons as $timestamp => $cronhooks ) { if ( $timestamp > $gmt_time ) { break; } $results[ $timestamp ] = $cronhooks; } return $results; } also found here: https://developer.wordpress.org/reference/functions/wp_get_ready_cron_jobs/ When you update to the next version this will be overwritten, but it will also have the fix in it so you won’t have to worry. I’ve ran this plugin on WP v4.9 and it works with this code.

webheadcoder 2019-11-23T00:10:00+00:00

version 1.2 is out and should fix this issue. Thank you for reporting it.