Cron task with scheduled timestamp in the past

The reason is when you set only a time without date, the php function strtotime() by default add today as a date so if the time is “04:30”, the timestamp is in the past. I fixed like this : $timestamp = strtotime( $cron_sync_time ); if( $timestamp < time() ){ //if the time already past today … Read more

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

tech