Run external file cron using WordPress Scheduler
Run external file cron using WordPress Scheduler
Run external file cron using WordPress Scheduler
WordPress Multisite cron jobs using cron tab
You’re not specifying the number of posts you want back from the query, so it defaults to whatever you have set under Settings > Reading. If you want all that match your criteria, then add ‘posts_per_page’ => -1 to your query arguments.
What your are doing is that you are looping over an array of post objects. The get_posts() function returns objects, not ID’s. So what you will have to do is either use $post_id->ID or setup_postdata( $post_id ) and then use get_the_ID(). Might wanna rename $post_id to $post_object to avoid confusion.
The official wordpress documentation https://developer.wordpress.org/plugins/cron/hooking-into-the-system-task-scheduler/ suggests doing it via a web request rather as per your first example rather than php CLI as per your second example. Their example uses wget, but your curl request would work just as well. I believe they are using the web request replicates the standard http requests that would … Read more
The problem was in scheduled cron jobs. While testing I had previously set cron job for the same hook. After inspecting cron jobs I managed to delete that test schedule and now it is working.
The problem is that you’re only hooking the cron action on admin_init, which doesn’t run when wp-cron.php is called. So the function will never run. So this function shouldn’t be inside wpcp_activate(): add_action( ‘wpcp_cron_hook’, ‘wpcp_cron_do’ ); Also, register_activation_hook() shouldn’t be inside the admin_init hook either. So your code should look like this: function wpcp_make_post( $post_title, … 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
wp_schedule_event doesn’t work