Skip to main content

Customize the URLs Preloaded by FlyingPress

Updated this week

FlyingPress automatically preloads a list of URLs to ensure important pages are cached and load instantly for visitors. By default, it includes:

  • Home page

  • Posts

  • Pages

  • Custom post types

  • Author pages

  • Categories, tags, and other taxonomies

You can customize this list using the flying_press_preload_urls filter.

Where to add this code

Add the code in one of the following:

  • Your theme’s functions.php file

  • A custom plugin

  • A plugin like Code Snippets

Important

The flying_press_preload_urls filter is called multiple times, each time with a batch of URLs. Do not assume it receives the full list in a single call.

Add URLs to the preload list

add_filter('flying_press_preload_urls', function ($urls) {
$urls[] = 'https://example.com/your-page/';
$urls[] = 'https://example.com/another-page/';
return $urls;
});

This will ensure your custom URLs are included during the preload process.

Remove URLs from the preload list

add_filter('flying_press_preload_urls', function ($urls) {
$remove_urls = [
'https://example.com/remove-this-page/',
'https://example.com/also-remove-this-page/',
];

$filtered_urls = array_diff($urls, $remove_urls);
return array_values($filtered_urls);
});

This removes specific pages from the preload queue.

Notes

  • Matching is by exact URL, including protocol (http/https) and trailing slashes

  • Since the filter is called in batches, your logic should work for partial lists

  • You can both add and remove URLs in the same filter if needed

Did this answer your question?