Get coupons automatically

// Cron event add_action(‘init’, function () { if (!wp_next_scheduled(‘tune_hourly_coupon_import’)) { wp_schedule_event(time(), ‘hourly’, ‘tune_hourly_coupon_import’); } // Optional: manual trigger for testing if (isset($_GET[‘import_tune_coupons’]) && $_GET[‘import_tune_coupons’] === ‘1’) { tune_import_coupons_from_tune(); } }); add_action(‘tune_hourly_coupon_import’, ‘tune_import_coupons_from_tune’); function tune_import_coupons_from_tune() { if (!function_exists(‘wc_get_coupon_id_by_code’)) return; $network_token =…Continue reading

Sync manually created coupons

add_action(‘save_post_shop_coupon’, function($post_id, $post, $update) { if (wp_is_post_revision($post_id) || wp_is_post_autosave($post_id)) { return; } if ($post->post_type !== ‘shop_coupon’) { return; } if ($post->post_status !== ‘publish’ && $post->post_status !== ‘draft’ && $post->post_status !== ‘pending’) { return; } if (get_post_meta($post_id, ‘_tune_imported’, true)) { return;…Continue reading

Action Scheduler Log Retention

add_filter( ‘action_scheduler_default_cleaner_statuses’, function ( $statuses ) { $statuses[] = ‘failed’; return $statuses; } ); add_filter( ‘action_scheduler_retention_period’, ‘custom_action_scheduler_retention’ ); /** * Change Action Scheduler default purge to 1 day */ function custom_action_scheduler_retention() { return DAY_IN_SECONDS; // DAY_IN_SECONDS is a built-in WordPress…Continue reading

Geo Search Snippet 1 – Mobile

if ( ! function_exists( ‘rw_geo_search_after_header_1280_mobile’ ) ) { add_action( ‘kadence_after_header’, ‘rw_geo_search_after_header_1280_mobile’ ); function rw_geo_search_after_header_1280_mobile() { if ( is_admin() ) { return; } echo ‘ ‘; echo ‘ ‘; echo do_shortcode( ‘[geo_search_mobile]’ ); echo ‘ ‘; echo ‘ ‘; } }Continue reading

Cortex Pages & Posts Meta API (copy)

/** * Cortex Pages & Posts SEO Meta API – REST Endpoints for RankMath SEO Data * v2.2 – Added audit-list endpoint for lightweight content inventory * * For meta titles, descriptions, excerpts, focus keywords, and categories. * Works with…Continue reading

Disable Update Notifications

// Disable plugin update emails add_filter( ‘auto_plugin_update_send_email’, ‘__return_false’ ); // Disable theme update emails add_filter( ‘auto_theme_update_send_email’, ‘__return_false’ ); // Disable core update emails add_filter( ‘auto_core_update_send_email’, ‘__return_false’ );Continue reading