Advertisement
swte

Disable Delay Async Scripts on specific pages

Mar 19th, 2021
1,025
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.46 KB | None | 0 0
  1. /**
  2.  * Plugin Name: Swift Performance Tweaks
  3.  * Override settings on specific pages
  4.  */
  5.  
  6. // Disable Delay Async Scripts on specific pages
  7. add_filter('swift_performance_option_delay-async-scripts function($value){
  8.     $pages = array(
  9.         '', // use empty for homepage
  10.         '/page-1',
  11.         '/another-page',
  12.     );
  13.    if (isset($_SERVER['REQUEST_URI']) && in_array(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH), $pages)){
  14.        return 0;
  15.    }
  16.    return $value;
  17. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement