How to Set a Condition via Page Template Name in WP Cron Job?

Finally i can able to achieve it. // custom_schedules_create function custom_schedules_create( $schedules ) { $schedules[‘every_three_minutes’] = array( ‘interval’ => 180, ‘display’ => __( ‘Every 3 Minutes’, ‘textdomain’ ) ); return $schedules; } add_filter( ‘cron_schedules’, ‘custom_schedules_create’ ); // custom_3minutes_event if ( ! wp_next_scheduled( ‘custom_3minutes_event’ ) ) { $myLocalGMTTimeEvent = time() + 6*60*60; wp_schedule_event( $myLocalGMTTimeEvent, ‘every_three_minutes’, ‘custom_3minutes_event’ … Read more

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

How to run SQL query from WordPress ‘WP Crontrol’ plugin

I managed to get things working by using: include_once(“wp-config.php”); include_once(“wp-includes/wp-db.php”); global $wpdb; $sql = “UPDATE wp_pmpro_memberships_users SET wp_pmpro_memberships_users.status=”admin_cancelled” WHERE wp_pmpro_memberships_users.user_id IN ( /*Select all users that have an active Membership but no active Subscription*/ SELECT pmpro.user_id FROM wp_pmpro_memberships_users as pmpro JOIN wp_pmpro_membership_levels as pmprol ON pmprol.id=pmpro.membership_id JOIN wp_users ON pmpro.user_id = wp_users.ID WHERE pmpro.status=”active” AND … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)