Articles on: Developers

Change URLs in the preload list

FlyingPress automatically preloads a list of URLs, including:
- Home page
- Posts
- Pages
- Custom posts
- Authors
- Catgories, tags and other traxonomies

Using flying_press_preload_urls filter, you can customize the list of URLs to preload.

Add URLs to preload



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


Remove URLs from preload



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);
});


Limit number of URLs



Limits the numbers of URLs to preload to 200:

add_filter('flying_press_preload_urls', function ($urls) {
  return array_slice($urls, 0, 200);
});

Updated on: 15/03/2024

Was this article helpful?

Share your feedback

Cancel

Thank you!