Advertisement
swte

Disable Delay Async Scripts on specific pages v2

Mar 23rd, 2021
822
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.37 KB | None | 0 0
  1. <?php
  2.  
  3. add_filter('swift_performance_option_delay-async-scripts', function($value){
  4.     $pages = array(
  5.         '', // use empty for homepage
  6.         '/contact',
  7.         '/reservation',
  8.     );
  9.     if (isset($_SERVER['REQUEST_URI']) && in_array(trim(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH),'/'), $pages)){
  10.         return 0;
  11.     }
  12.     return $value;
  13. });
  14.  
  15.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement