Actions
Before and after purging URL
Run your code before purging a single URL (page): addaction('flyingpresspurgeurl:before', function($url) // Write your code here ); Similarly, run after purging a single URL (page): addaction('flyingpresspurgeurl:after', function($url) // Write your code here );Few readersBefore and after purging all pages
Run your code before purging all pages: addaction('flyingpresspurgepages:before', function() // Write your code here ); Similarly, run after purging all pages: addaction('flyingpresspurgepages:after', function() // Write your code here );Few readersBefore and after purging everything
Run your code before purging everything: addaction('flyingpresspurgeeverything:before', function() // Write your code here ); Similarly, run after purging everything: addaction('flyingpresspurgeeverything:after', function() // Write your code here );Few readersFlyingPress plugin upgraded
Run any code when the FlyingPress plugin updates: addaction('flyingpressupgraded',function() // Write your code here );Few readers
Filters
Change delay in preloading cache
FlyingPress default adds a delay of 0.5s while preloading the cache between each page. This slows down the process and ensures your server doesn't run out of resources. Here is how to set to delay as 1s - recommended for very low-resource servers: addfilter('flyingpresspreloaddelay', function() return 1; ); If you have a dedicated or high-end server, you can remove this delay by setting it to 0s as below:PopularModify optimized HTML output
You can use " flyingpressoptimization:after" filter to modify the final HTML which is optimized by FlyingPress. This modified HTML will be saved cache and served to visitors. addfilter('flyingpressoptimization:after', function($html) // Modify $html here return $html; );Some readersCache page or not
The "flyingpressiscacheable" filter is used to specify custom conditions for determining whether FlyingPress should cache a page or not. addfilter('flyingpressiscacheable', function($iscacheable) // write custom condition where FlyingPress should not cache content return $iscacheable; );Few readersDisable cache preloading
You can use the "flyingpresspreloadcache" filter to disable cache preloading as follows: addfilter('flyingpresspreloadcache', 'returnfalse');Few readersChange JavaScript delay timeout
FlyingPress has a default timeout of 10s for delaying JavaScript. You can change it to any custom timeout. Here is how to set the timeout as 5s: addfilter('flyingpressjsdelaytimeout', function() return 5; );Few readersAdd additional URLs to preload
FlyingPress fetches URLs to preload automatically; this includes posts, pages, custom posts, and taxonomies (category, tags etc.). If you've URLs that are not in this list but should be preloaded, you can use the filter "flyingpresspreloadurls" like below:Few readersExclude files from JavaScript minify
FlyingPress UI doesn't provide an option to exclude JavaScript files from minify because it's compatible with 99.99% of the files. However, in any chance you would like to exclude JavaScript files from minifying, you can use the filter "flyingpressexcludefromminify:js" like below: addfilter('flyingpressexcludefromminify:js', function($excludekeywords) $excludekeywords = 'my-theme' ; return $excludekeywords; );Few readersExclude files from CSS minify
FlyingPress UI doesn't provide an option to exclude CSS files from minify because it's compatible with 99.99% of the files. However, in any chance you would like to exclude CSS files from minifying, you can use the filter "flyingpressexcludefromminify:css" like below: addfilter('flyingpressexcludefromminify:css', function($excludekeywords) $excludekeywords = 'my-theme' ; return $excludekeywords; );Few readersChange FlyingPress .htaccess rules
FlyingPress injects some rules to .htaccess to serve cached pages directly by the web server. You can change the rules by using the " flyingpresshtaccessrules" filter. The wrong htaccess rule may result in a server error and crash your entire site, be careful. addfilter('flyingpresshtaccessrules', function($flyingpressrules) // Change $flyingpressrules here return $flyingpressrules; );Few readersChange YouTube placeholder resolution
When you've enabled "Use placeholder images for YouTube videos", the placeholder defaults to the resolution "hqdefault". You can change that using the filter "flyingpressyoutubeplaceholderresolution":Few readersChange cached file name
FlyingPress generate a default cache file name like "index.html" or "index-logged-in.html", etc. The " flyingpresscachefilename" filter is used to modify the name of the cache file generated by FlyingPress. addfilter('flyingpresscachefilename', function($filename) $filename = 'joy-'.$filename; return $filename; );Few readersManage access to FlyingPress
The default access to the FlyingPress dashboard and features is limited to users with the roles of " administrator" and "editor". However, the "flyingpressallowedroles" filter can extend or restrict the allowed roles. Add a new role: addfilter('flyingpressallowedroles', function($roles) $roles = 'subscriber'; return $roles; ); Allow only selected roles: addfilter('flyingpressallowedroles', function($roles) return 'administrator' ; );Few readersAdd or remove URLs to auto purge
FlyingPress automatically updates its cache of URLs to be purged whenever you publish, update, or delete content. However, if you want to add or remove specific URLs from this list, you can do so using the appropriate filters. addfilter('flyingpressautopurgeurls', function($urls, $postid) $urls = "https://example.com/your-page/"; return $urls; ,10,2);Few readers
Functions
Purge cache
Purge single URL: FlyingPressPurge::purgeurl($url); Purge multiple URLs: FlyingPressPurge::purgeurls($urls); Purge all pages: FlyingPressPurge::purgepages(); Purge everything: FlyingPressPurge::purgeeverything();PopularPreload cache
Preload a single URL (page): FlyingPressPreload::preload($url); Preload multiple URLs (pages): FlyingPressPreload::preloads($urls); Preload all pages: FlyingPressPreload::preloadcache();Few readers