cron job for custom post type not working since WordPress 5
cron job for custom post type not working since WordPress 5
cron job for custom post type not working since WordPress 5
Scheduled cron event removed from list automatically after sometime
Let me answer your questions starting from the second one… So… Why is it deleting all posts at once? You scheduled you event correctly, so it will run once a day. And in the function that is run, you select some posts and delete them, if they’re expired: $args = array( ‘post_type’ => ‘post’, ‘category_name’ … Read more
You can test if mail has been sent or not using the following: // Set $to as the email you want to send the test to. $to = “[email protected]”; // Email subject and body text. $subject=”wp_mail function test”; $message=”This is a test of the wp_mail function: wp_mail is working.woo!”; $headers=””; // Load WP components, no … Read more
Trying to configure cron to get next value from array on each run
WordPress Cron Jobs are not “real” Cronjobs, instead they relie on somebody visiting the site, then looking if it’s time to do scheduled jobs. 1.: Someone visits the website 2.: WordPress calls the file wp-cron.php 3.: wp-cron.php looks into the database if there are scheduled jobs that are due at this time. 4.: wp-cron.php does … Read more
You will have to write a plugin which creates a daily cron job in the WordPress system. Here’s an article describing how to write a cron plugin: https://wpguru.co.uk/2014/01/how-to-create-a-cron-job-in-wordpress-teach-your-plugin-to-do-something-automatically/ The function (callback) that you trigger in the cron plugin will use WP_QUERY to get a list of all your published custom post types after a certain … Read more
Comparing your code to the WordPress function wp_schedule_single_event, it appears you failed to indicate that parameters would be passed. Perhaps the following version of your code will work for you. add_action( ‘crondelete’, ‘delete_page_in’,10,1); wp_schedule_single_event($seconds, ‘crondelete’, array($new_post_id )); Notice the add_action now includes two extra parameters: 10=Priority, and 1=Accepted Arguments to be passed.
Update post status from “publish” to “trash” prior to year 2018
CRON job to update wp_usermeta value each day or week based on server time