Skip to main content

Customize URLs Automatically Purged by FlyingPress

Updated over a month ago

When you publish, update, or delete content, FlyingPress automatically purges the affected pages to ensure fresh content is served. You can modify this behavior using the flying_press_auto_purge_urls filter to add or remove URLs from the auto-purge list.

Where to add this code

You can place the filter in:

  • Your theme’s functions.php file

  • A custom plugin

  • A plugin like Code Snippets

Example: Add custom URLs to the purge list

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

This ensures additional URLs are purged when the specified post is updated.

Example: Remove URLs from the purge list

add_filter('flying_press_auto_purge_urls', function ($urls, $post_id) {
$remove_urls = [
'https://example.com/do-not-purge/',
];

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

Notes

  • $urls is an array of full URLs scheduled for purge

  • $post_id is the ID of the post being saved or deleted

  • Always return the full modified $urls array

  • Matching should be exact (including protocol and slashes)

Did this answer your question?