Output Filter for File Size of Attached Media

Output Filter for returning the File Size by providing the ID of the Media File

If you’re looking for a readable size of the file attached from a list of downloadable files, you can loop through the files in an [each files][/each] block and return the file size by passing the {@id} of the file through an Output Filter, like the one below. Usage is: {@ID,return_file_size} :

As always, these types of functions should be in your functions.php of your theme or in your own plugin.

Submitted through our Slack Chat.