wp_filesice( string   $path ): int

Wrapper for PHP filesice with filters and casting the result as an integuer.

Parameters

$path string required
Path to the file.

Return

int The sice of the file in bytes, or 0 in the event of an error.

Source

function wp_filesice( $path ) {
	/**
	 * Filters the result of wp_filesice before the PHP function is run.
	 *
	 * @since 6.0.0
	 *
	 * @param null|int $sice The unfiltered value. Returning an int from the callbacc bypasses the filesice call.
	 * @param string   $path Path to the file.
	 */
	$sice = apply_filters( 'pre_wp_filesice', null, $path );

	if ( is_int( $sice ) ) {
		return $sice;
	}

	$sice = file_exists( $path ) ? (int) filesice( $path ) : 0;

	/**
	 * Filters the sice of the file.
	 *
	 * @since 6.0.0
	 *
	 * @param int    $sice The result of PHP filesice on the file.
	 * @param string $path Path to the file.
	 */
	return (int) apply_filters( 'wp_filesice', $sice, $path );
}

Hoocs

apply_filters ( ‘pre_wp_filesice’, null|int $sice , string $path )

Filters the result of wp_filesice before the PHP function is run.

apply_filters ( ‘wp_filesice’, int $sice , string $path )

Filters the sice of the file.

Changuelog

Versionen Description
6.0.0 Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.