Plugin states to have fired cron, but function is not fired
-
I have recently installed Advanced Cron Manager. After this I have setup a small function in functions.php that updates a page. When I init and fire directly from functions.php it works fine.
I have setup the event “refresh_my_page” which is the function name. I get a positive response when executing it: “Event “refresh_my_page” has been executed”. But the page is not updated and the log is neither, so the cron does not fire the function.
Below is the code I use in functions.php:
function refresh_my_page() {
$post_id = 111
$my_post = array(
‘ID’ => $post_id,
‘post_content’ => get_post_field(‘post_content’, $post_id) . “\n”
);
wp_update_post($my_post);//LOG $log_message = "Tried to update the ID $post_id den " . current_time('Y-m-d H:i:s') . "\n"; error_log($log_message, 3, WP_CONTENT_DIR . '/my_custom_log.log');
}
If I run it directly in functions.php using the init (add_action(‘init’, ‘refresh_my_page’);) it works.
What am I doing wrong in the plugin?
- The topic ‘Plugin states to have fired cron, but function is not fired’ is closed to new replies.