WordPress at Your Fingertips
function is not described


Api::get_file_version() protected WC 1.0

Get the file modified time as a cache buster if we're in dev mode.

{} It's a method of the class: Api{}

No Hooks.


String. The cache buster value to use for the given file.


// protected - for code of main (parent) or child class
$result = $this->get_file_version( $file );
$file(string) (required)
Local path to the file (relative to the plugin directory).

Code of Api::get_file_version() WC 5.6.0

protected function get_file_version( $file ) {
	if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG && file_exists( $this->package->get_path() . $file ) ) {
		return filemtime( $this->package->get_path( trim( $file, '/' ) ) );
	return $this->package->get_version();