/** * PNP ADMIN SPEED + VISITOR OPTIMIZER * VERSION 7.0 - NO MORE 403 ERRORS */ // 1. DISABLE BACKGROUND NOISE FOR ADMIN if ( is_admin() ) { // Stop RankMath Content AI (Prevents the 403 errors in your log) add_filter( 'rank_math/modules/content_ai', '__return_false' ); // Stop WooCommerce Analytics from loading background notes add_filter( 'woocommerce_admin_features', function( $features ) { return array_diff( $features, ['analytics', 'remote-inbox-notifications', 'onboarding'] ); }); // Speed up the "Update" button response add_filter( 'nonce_life', function () { return 48 * HOUR_IN_SECONDS; } ); return; // Stop here for Admins } /* --- VISITOR OPTIMIZATIONS BELOW --- */ add_action( 'init', function() { wp_deregister_script('heartbeat'); remove_action( 'shutdown', 'wp_ob_end_flush_all', 1 ); }, 1); add_action( 'wp_enqueue_scripts', function() { wp_dequeue_style( 'wp-block-library' ); if ( is_checkout() ) { $killers = ['wc-cart-fragments','xt-woofc-js','sbi_scripts','cffscripts','google-listings-and-ads']; foreach ( $killers as $h ) { wp_dequeue_script( $h ); } } }, 9999); // [Include your Phone Validation and Celebration logic here...]