Mobile Redirect

add_action(‘template_redirect’, ‘rd_mobile_redirect’); function rd_mobile_redirect() { // 1. Don’t redirect if we are in the editor or doing ajax if ( defined( ‘DOING_AJAX’ ) && DOING_AJAX ) return; if ( isset( $_GET[‘elementor-preview’] ) ) return; // 2. Detect Mobile Devices $is_mobile…Continue reading

[DEBUG] SiteGround Purge Scheduling

add_filter(‘pre_schedule_event’, function ($pre, $event /*, $wp_error */) { if (is_object($event) && isset($event->hook) && $event->hook === ‘siteground_optimizer_purge_cron_cache’) { $bt = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 18); $lines = []; foreach ($bt as $f) { $fn = (isset($f[‘class’]) ? $f[‘class’] . ($f[‘type’] ?? ”) : ”)…Continue reading

Cloudflare Gravity Forms fix

add_filter( ‘wp_inline_script_attributes’, function ( $attributes, $javascript ) { if ( strpos( $javascript, ‘gform.’ ) ) { $attributes[‘data-cfasync’] = ‘false’; } return $attributes; }, 10, 2 );Continue reading