Title: Manual wp-cron Scheduling Causes PHP wp_cache_flush_runtime Error
Last modified: January 6, 2023

---

# Manual wp-cron Scheduling Causes PHP wp_cache_flush_runtime Error

 *  Resolved [David Adams](https://wordpress.org/support/users/tictag/)
 * (@tictag)
 * [3 years, 5 months ago](https://wordpress.org/support/topic/manual-wp-cron-scheduling-causes-php-wp_cache_flush_runtime-error/)
 * Rank Math was installed on a website I recently took ownership of. As far as 
   I know, there were no issues with it. I found that most wp-cron jobs were being
   severely delayed due to a lack of site visitors so I disabled wp-cron scheduling`
   define('DISABLE_WP_CRON', true);` and instead initiated wp-cron with a server`
   crontab` job `wp cron event run --due-now, 0,30 * * * *` to forcibly initiate
   wp-cron every 30 minutes, irrespective of site visitors.
 * This works fine and now all wp-cron functions execute without delay.
 * Since running wp-cron this way, however, the OS (Fedora Linux) `crontab` job 
   and WordPress debugging reports the following PHP Notice:
 * `Notice: Function wp_cache_flush_runtime was called <strong>incorrectly</strong
   >. Your object cache implementation does not support flushing the in-memory runtime
   cache. Please see <a href="[https://wordpress.org/support/article/debugging-in-wordpress/](https://wordpress.org/support/article/debugging-in-wordpress/)"
   >Debugging in WordPress</a> for more information. (This message was added in 
   version 6.1.0.) in /home/customer/www/<server>/public_html/wp-includes/functions.
   php on line 5835`
 * I traced this error back to a Rank Math wp-cron hook/action (I’m sorry, I don’t
   remember which one). Deactivating Rank Math solved the problem.
 * I would like to continue running Rank Math but also have a level of control over
   wp-cron for the reasons stated above.
 * Is this possible? Or is it one or the other?
 * David.

Viewing 9 replies - 1 through 9 (of 9 total)

 *  Plugin Support [Rank Math Support](https://wordpress.org/support/users/rankmathteam/)
 * (@rankmathteam)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/manual-wp-cron-scheduling-causes-php-wp_cache_flush_runtime-error/#post-16362445)
 * Hello [@tictag](https://wordpress.org/support/users/tictag/),
 * Thank you for contacting the support, and sorry for any inconvenience that might
   have been caused due to that.
 * Can you please try the following filter?
   `function wp_cache_supports( $feature){
   if ( $feature === 'flush_runtime' ) {return true;}return false;}
 * There’s also a proposed change here:
   [https://core.trac.wordpress.org/changeset/54448](https://core.trac.wordpress.org/changeset/54448)
 * Hope that helps.
 *  [negapo](https://wordpress.org/support/users/negapo/)
 * (@negapo)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/manual-wp-cron-scheduling-causes-php-wp_cache_flush_runtime-error/#post-16385334)
 * We have the same problem, will you do anything at the plug-in side on future 
   versions to solve this?
 * The above code isn’t a filter right, its a core WP function, should we overwrite
   it?
 *  Thread Starter [David Adams](https://wordpress.org/support/users/tictag/)
 * (@tictag)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/manual-wp-cron-scheduling-causes-php-wp_cache_flush_runtime-error/#post-16385873)
 * Apologies for the delay is replying, I’ve had some personal matters to attend
   to.
 * I added the code above to a ‘Snippets’ snippet and received the following error
   on activation:
 * `The snippet has been deactivated due to an error on line 2:
   Cannot redeclare
   function wp_cache_supports.
 * Please advise.
 *  Plugin Support [Rank Math Support](https://wordpress.org/support/users/rankmathteam/)
 * (@rankmathteam)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/manual-wp-cron-scheduling-causes-php-wp_cache_flush_runtime-error/#post-16388205)
 * Hello [@tictag](https://wordpress.org/support/users/tictag/),
   The function we
   shared is a default function since WordPress 6.1 so you would need to add this
   to the following file and replace the current implementation: `wp-includes\cache-
   compat.php`Don’t hesitate to get in touch if you have any other questions.
 *  Thread Starter [David Adams](https://wordpress.org/support/users/tictag/)
 * (@tictag)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/manual-wp-cron-scheduling-causes-php-wp_cache_flush_runtime-error/#post-16389948)
 * Do you not think that this information should have been included in your original
   request, or were you expecting me to know this off-hand?
 * I am not prepared to hack my WordPress installation just to do your troubleshooting
   for you. This is a live site and I am not clever enough to be able to fix it 
   if your hack doesn’t work.
 * Are you able to re-create this issue on your own test sites? If so, please just
   let me know when you have a fix available. Until then, I will keep Rank Math 
   disabled whilst I look for an alternative.
 * The clock is ticking.
 *  Thread Starter [David Adams](https://wordpress.org/support/users/tictag/)
 * (@tictag)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/manual-wp-cron-scheduling-causes-php-wp_cache_flush_runtime-error/#post-16389953)
 * p.s. This ticket has NOT been resolved!!
 *  Plugin Support [Rank Math Support](https://wordpress.org/support/users/rankmathteam/)
 * (@rankmathteam)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/manual-wp-cron-scheduling-causes-php-wp_cache_flush_runtime-error/#post-16392518)
 * Hello [@tictag](https://wordpress.org/support/users/tictag/),
 * Sorry for the inconvenience caused. However, adding the filter to the file mentioned
   before shouldn’t cause any issues with the site and will fix the issue.
 * Having said that, we are working on a fix for this and will inform you here once
   we release an update.
 * We really appreciate your patience in the meantime.
 *  [negapo](https://wordpress.org/support/users/negapo/)
 * (@negapo)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/manual-wp-cron-scheduling-causes-php-wp_cache_flush_runtime-error/#post-16403624)
 * Just a side note, that’s not a filter, that’s a function, not a good idea to 
   change core functions but if this a temporary issue there is no problem. The 
   main thing is the last post, thats what we want to hear, this is not a environment
   or installation issue, its a bug thats being addressed.
 *  Plugin Support [Rank Math Support](https://wordpress.org/support/users/rankmathteam/)
 * (@rankmathteam)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/manual-wp-cron-scheduling-causes-php-wp_cache_flush_runtime-error/#post-16409928)
 * Hello [@negapo](https://wordpress.org/support/users/negapo/),
 * Yes, it was a temporary solution and the fix will be released in the upcoming
   update of our plugin. You can keep an eye on our changelog to get notified: [https://rankmath.com/changelog/](https://rankmath.com/changelog/)
 * Let us know if you need any other assistance.

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Manual wp-cron Scheduling Causes PHP wp_cache_flush_runtime Error’ is
closed to new replies.

 * ![](https://ps.w.org/seo-by-rank-math/assets/icon.svg?rev=3438330)
 * [Rank Math SEO – AI SEO Tools to Dominate SEO Rankings](https://wordpress.org/plugins/seo-by-rank-math/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/seo-by-rank-math/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/seo-by-rank-math/)
 * [Active Topics](https://wordpress.org/support/plugin/seo-by-rank-math/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/seo-by-rank-math/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/seo-by-rank-math/reviews/)

## Tags

 * [crontab](https://wordpress.org/support/topic-tag/crontab/)

 * 9 replies
 * 3 participants
 * Last reply from: [Rank Math Support](https://wordpress.org/support/users/rankmathteam/)
 * Last activity: [3 years, 4 months ago](https://wordpress.org/support/topic/manual-wp-cron-scheduling-causes-php-wp_cache_flush_runtime-error/#post-16409928)
 * Status: resolved