CPW Media Offload for Cloudflare R2 1.5.4 has 13 actions and 22 filters, read directly from its source code on Nov 18, 2026. The list updates automatically when a new version is released.
How to use these hooks
Actions let you run your own code at a specific moment. Filters let you change a value before the plugin uses it. Put your code in a child theme's functions.php or a code-snippets plugin, never in the plugin's own files, because updates overwrite them.
// Run your own code when CPW Media Offload for Cloudflare R2 fires an action
add_action( 'cpw_r2_offloaded', function( $attachment_id, $data ) {
// Your code runs here.
}, 10, 2 );
// Change a value CPW Media Offload for Cloudflare R2 is about to use
add_filter( 'cpw_r2_admin_tabs', function( $value ) {
// Change $value here.
return $value;
}, 10, 1 );Parts of a name in {braces} are filled in at runtime (for example a post type or field ID). Choose Example on any hook for a ready-to-edit snippet.
All hooks
-
/** * Fires after an attachment has been offloaded. */ do_action( 'cpw_r2_offloaded', $attachment_id, $data ); -
/** * This action is documented in includes/class-cpw-r2-admin.php */ do_action( 'cpw_r2_settings_saved' ); -
/** * Filters the tabs of the plugin screen. */ apply_filters( 'cpw_r2_admin_tabs', array() ); -
/** * Filters the files uploaded to Cloudflare R2 for an attachment. */ apply_filters( 'cpw_r2_attachment_files', $files, $attachment_id ); -
/** * Filters a rewritten attachment URL. */ apply_filters( 'cpw_r2_attachment_url', CPW_R2_Media::versioned_url( $base . '/' . $relative, $data ), $url, $attachment_id ); -
/** * Fires once the page builder caches have been cleared. */ do_action( 'cpw_r2_cache_flushed' ); -
/** * Filters whether an attachment should be offloaded. */ apply_filters( 'cpw_r2_can_offload', true, $attachment_id ); -
/** * Filters the list of content filters where URLs are rewritten. */ apply_filters( 'cpw_r2_content_filters', $filters ); -
/** * Filters whether the page caches are cleared after a media change. */ apply_filters( 'cpw_r2_flush_page_cache', true ); -
/** * Filters the image sizes still generated on the server. */ apply_filters( 'cpw_r2_kept_image_sizes', array( 'thumbnail' ) ); -
/** * Fires once every plugin component is registered. */ do_action( 'cpw_r2_loaded', $this ); -
/** * Filters the headers stored with an object on Cloudflare R2. */ apply_filters( 'cpw_r2_object_headers', $headers, $file_path ); -
/** * Filters the object key used for a file on Cloudflare R2. */ apply_filters( 'cpw_r2_object_key', $key, $relative_path ); -
/** * Fires once the page caches have been cleared after a media change. */ do_action( 'cpw_r2_page_cache_flushed', $cleared ); -
/** * Filters the upload folders that never go to the public bucket. */ apply_filters( 'cpw_r2_protected_dirs', array( 'woocommerce_uploads', 'edd' ) ); -
/** * Filters the public base URL used to serve offloaded files. */ apply_filters( 'cpw_r2_public_base_url', $base ); -
/** * Filters the URLs purged from the Cloudflare cache. */ apply_filters( 'cpw_r2_purge_urls', $urls ); -
/** * Fires after the remote copies of an attachment have been deleted. */ do_action( 'cpw_r2_removed', $attachment_id, $data ); -
/** * Renders the content of a tab registered on cpw_r2_admin_tabs. */ do_action( "cpw_r2_render_tab_{$tab}" ); -
/** * Filters the arguments of an outgoing Cloudflare R2 request. */ apply_filters( 'cpw_r2_request_args', $request_args, $method, $key ); -
/** * Filters whether a setting is managed elsewhere and read only here. */ apply_filters( 'cpw_r2_setting_locked', $locked, $key ); -
/** * Filters the resolved plugin settings. */ apply_filters( 'cpw_r2_settings', $settings ); -
/** * Filters whether the Pro presentation (top button and dashboard banner) is * shown. */ apply_filters( 'cpw_r2_show_pro_panel', CPW_R2_PRO_LAUNCHED ); -
/** * Filters the Cloudflare transformation options of a single URL. */ apply_filters( 'cpw_r2_transform_options', $options, $extra ); -
/** * Filters a Cloudflare transformation URL. */ apply_filters( 'cpw_r2_transform_url', $transformed, $url, $extra ); -
/** * Filters the widths generated for responsive images. */ apply_filters( 'cpw_r2_transform_widths', array( 480, 768, 1024, 1536, 2048 ) ); -
/** * Filters the file extensions sent through Cloudflare transformations. */ apply_filters( 'cpw_r2_transformable_extensions', array( 'jpg', 'jpeg', 'png', 'webp', 'avif' ) ); -
/** * Filters the mime types converted to WebP on upload. */ apply_filters( 'cpw_r2_webp_convertible_types', $convertible ); -
/** * This filter is documented in wp-includes/l10n.php */ apply_filters( 'plugin_locale', determine_locale(), $domain ); -
do_action( 'breeze_clear_all_cache' ); -
do_action( 'cache_enabler_clear_complete_cache' ); -
do_action( 'litespeed_purge_all' ); -
do_action( 'rt_nginx_helper_purge_all' ); -
do_action( 'wpfc_clear_all_cache' ); -
do_action( 'wphb_clear_page_cache' );
Generated from CPW Media Offload for Cloudflare R2's GPL-licensed source code. Hooks inside bundled third-party libraries are not listed.
Done for you
Rather have it built for you?
Tell us what should change and we’ll write and test the code using these hooks.
Custom hook snippet
from $49
A small, update-safe change built on the plugin’s own hooks.
- Code written against the plugin’s actions and filters
- Tested on a staging copy of your site
- Install instructions included
Typical turnaround: 2–3 business days
Choose thisPlugin customisation
from $149
New features or changed behaviour, without editing the plugin’s files.
- Built as a companion plugin, so updates never wipe it
- Exact quote before we start
- Tested on staging, then deployed
Typical turnaround: 3–7 business days
Choose thisNot sure which fits? Describe what you need and we’ll suggest the simplest option.
Can't find the right hook?
We can build the customisation for you. Describe what you need: