wp_max_upload_size(): int

Determines the maximum upload size allowed in php.ini.

Return

int Allowed upload size.

Source

if ( ! is_object( $attachment ) ) {
	return array();
}

$file     = get_attached_file( $attachment->ID );
$filename = wp_basename( $file );

$objects = array( 'attachment' );

if ( str_contains( $filename, '.' ) ) {
	$objects[] = 'attachment:' . substr( $filename, strrpos( $filename, '.' ) + 1 );
}

if ( ! empty( $attachment->post_mime_type ) ) {
	$objects[] = 'attachment:' . $attachment->post_mime_type;

Changelog

VersionDescription
2.5.0Introduced.

User Contributed Notes

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