CPU Overloading due to some hooks

This code is causing your replace_authors_name_attributes() function to run every time a page is visited on your site, so yes, your hooks are running: schedule_authors_consistency() { if (!wp_next_scheduled(‘consistent_author’)) { wp_schedule_single_event(time(), ‘consistent_author’); } } add_action(‘init’, ‘schedule_authors_consistency’); Since you do this three times and your code queries every product each time this is going to absolutely hammer … Read more

Having difficulties with WP cron

You can add debugging statements to your code to verify if the cron job is being scheduled and executed correctly. like you can use error_log() to log messages to the PHP error log: public function schedule_event() { if (!wp_next_scheduled(‘redirection_checker_hook’)) { error_log(‘Scheduling redirection_checker_hook’); wp_schedule_event(time(), ‘every_three_minutes’, ‘redirection_checker_hook’); } } public function redirection_checker_func() { error_log(‘Running redirection_checker_func’); update_option(‘test_option’, ‘success’); … Read more