WordPress media upload limit?

Three things you need to check.

upload_max_filesize, memory_limit and post_max_size in the php.ini configuration file exactly.

All of these three settings limit the maximum size of data that can be submitted and handled by PHP.

Typically post_max_size and memory_limit need to be larger than upload_max_filesize.


This is the function in WordPress that defines the constant you saw:

File: wp-includes/media.php
2843: /**
2844:  * Determines the maximum upload size allowed in php.ini.
2845:  *
2846:  * @since 2.5.0
2847:  *
2848:  * @return int Allowed upload size.
2849:  */
2850: function wp_max_upload_size() {
2851:   $u_bytes = wp_convert_hr_to_bytes( ini_get( 'upload_max_filesize' ) );
2852:   $p_bytes = wp_convert_hr_to_bytes( ini_get( 'post_max_size' ) );
2853: 
2854:   /**
2855:    * Filters the maximum upload size allowed in php.ini.
2856:    *
2857:    * @since 2.5.0
2858:    *
2859:    * @param int $size    Max upload size limit in bytes.
2860:    * @param int $u_bytes Maximum upload filesize in bytes.
2861:    * @param int $p_bytes Maximum size of POST data in bytes.
2862:    */
2863:   return apply_filters( 'upload_size_limit', min( $u_bytes, $p_bytes ), $u_bytes, $p_bytes );
2864: }

Leave a Comment