Cron job to change CPT

Try something like this: if (!wp_next_scheduled(‘update_members_types’)) { wp_schedule_event( time(), ‘daily’, ‘update_members_types’ ); } add_action ( ‘update_members_types’, ‘update_member_post_type’ ); function update_member_post_type() { $args = array( ‘post_type’ => ‘member’, ‘posts_per_page’ => ‘1’, ‘date_query’ => array( array( ‘after’ => strtotime( ‘-24 hours’ ) ) ) ); $members = get_posts( $args ); if ( $members ) { foreach ( … Read more

pingbacks testing

Q: Are pingbacks sent immediately when a post is published, or are they scheduled as a cron job? If the later is correct, how often does the job run and can I trigger it manually? A: You can install core control (wordpress plugin) to find out more. Q: Are there any other terms for PBs … Read more

Refresh page using Cron after any post is published

Well, I don’t think you can do this with cron. Browser sends request to server and gets response. It isn’t connected permanently to your server. So if you want to refresh page which is already displayed in browser, you have to force browser to send request for this page one more time (do refresh). Another … Read more

wp_schedule_event action not running

I think your problem may be in the use of $post->ID. In your code $post is an undefined variable. As you are inside a loop, try get_the_ID() instead of $post->ID: $post_ID = get_the_ID(); $request_start_time = get_post_meta( $post_ID, ‘_simple_start_date’, true ); if (date(‘Ymd’) == date(‘Ymd’, $request_start_time)){ $current_user = $post->post_author; $request_date = get_post_meta( $post_ID, ‘_simple_start_date’,true ); $request_year … Read more

wp_schedule_event didn’t work

Cron fires outside of the standard WordPress loop, so $post will not be filled with any post-related data when the function is called. It should be obvious, then, that providing an ID directly isn’t referencing the non-existent $post variable which is why it works in that scenario. The best way to set post_statuses to expired … Read more