acf/filesize
Allows shortcutting our ACF's filesize call to prevent us making filesystem calls. Mostly useful for third party plugins which may offload media to other services, and filesize calls will induce a remote download.
Usage
add_filter( 'acf/filesize', 'wp_kama_acf_filesize_filter', 10, 2 );
/**
* Function for `acf/filesize` filter-hook.
*
* @param int|null $null The default filesize.
* @param WP_Post $attachment The attachment post object we're looking for the filesize for.
*
* @return int|null
*/
function wp_kama_acf_filesize_filter( $null, $attachment ){
// filter...
return $null;
}
- $null(int|null)
- The default filesize.
- $attachment(WP_Post)
- The attachment post object we're looking for the filesize for.
Changelog
| Since 6.2.2 | Introduced. |
Where the hook is called
acf/includes/api/api-helpers.php 2736
$shortcut_filesize = apply_filters( 'acf/filesize', null, $attachment );