{"id":1464,"date":"2021-07-18T02:27:22","date_gmt":"2021-07-17T23:27:22","guid":{"rendered":"https:\/\/saedx.com\/blog\/?p=1464"},"modified":"2021-07-18T02:29:06","modified_gmt":"2021-07-17T23:29:06","slug":"how-to-reduce-the-maximum-upload-size-to-media-in-wordpress","status":"publish","type":"post","link":"https:\/\/saedx.com\/blog\/how-to-reduce-the-maximum-upload-size-to-media-in-wordpress","title":{"rendered":"How to Reduce the Maximum Upload Size to Media in WordPress"},"content":{"rendered":"\n<p>If you are building a WordPress website for your clients that you host their website in your VPS or dedicated server you may need to prevent them from uploading large images or videos to the WordPress media library when they uploading a single media file. you don&#8217;t want them to be able to upload media files larger than 2MB example.<\/p>\n\n\n\n<p>By default, the maximum upload size in WordPress ranges from 32MB to 256MB depending on the settings of server hosting is giving by default.<\/p>\n\n\n\n<p>To see what is the current max upload size limit allowed in the WordPress site then go to WordPress Admin dashboard \u2192 Media \u2192 Add New. the allowed max upload size will be shown as the below screenshot image (Yellow highlighted).<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/saedx.com\/blog\/wp-content\/uploads\/2021\/07\/Screenshot1.jpg\" data-rel=\"penci-gallery-image-content\" ><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"235\" src=\"https:\/\/saedx.com\/blog\/wp-content\/uploads\/2021\/07\/Screenshot1-1024x235.jpg\" alt=\"\" class=\"wp-image-1468\" srcset=\"https:\/\/saedx.com\/blog\/wp-content\/uploads\/2021\/07\/Screenshot1-1024x235.jpg 1024w, https:\/\/saedx.com\/blog\/wp-content\/uploads\/2021\/07\/Screenshot1-300x69.jpg 300w, https:\/\/saedx.com\/blog\/wp-content\/uploads\/2021\/07\/Screenshot1-768x176.jpg 768w, https:\/\/saedx.com\/blog\/wp-content\/uploads\/2021\/07\/Screenshot1-1536x352.jpg 1536w, https:\/\/saedx.com\/blog\/wp-content\/uploads\/2021\/07\/Screenshot1-1170x268.jpg 1170w, https:\/\/saedx.com\/blog\/wp-content\/uploads\/2021\/07\/Screenshot1-585x134.jpg 585w, https:\/\/saedx.com\/blog\/wp-content\/uploads\/2021\/07\/Screenshot1.jpg 1897w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p>If the current max upload size limit doesn\u2019t meet your demand then don\u2019t fret, there are many ways you can reduce the max upload size in WordPress. We will be going to highlight the following ways in this article.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">1- Modify php.ini through cPanel<\/h2>\n\n\n\n<div class=\"wp-block-group alignwide\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<p>The best way to reduce the maximum upload size in WordPress is through the website cPanel by modifying <strong>php.ini<\/strong> file, and here is the easiest way to do that:<\/p>\n\n\n\n<ul><li><strong>Login to website cPanel<\/strong><\/li><\/ul>\n\n\n\n<ul><li><strong>Go to software section<\/strong><\/li><\/ul>\n\n\n\n<ul><li><strong>Click on MultiPHP INI Editor<\/strong><\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/saedx.com\/blog\/wp-content\/uploads\/2021\/07\/2-1.jpg\" data-rel=\"penci-gallery-image-content\" ><img decoding=\"async\" loading=\"lazy\" width=\"665\" height=\"265\" src=\"https:\/\/saedx.com\/blog\/wp-content\/uploads\/2021\/07\/2-1.jpg\" alt=\"\" class=\"wp-image-1467\" srcset=\"https:\/\/saedx.com\/blog\/wp-content\/uploads\/2021\/07\/2-1.jpg 665w, https:\/\/saedx.com\/blog\/wp-content\/uploads\/2021\/07\/2-1-300x120.jpg 300w, https:\/\/saedx.com\/blog\/wp-content\/uploads\/2021\/07\/2-1-585x233.jpg 585w\" sizes=\"(max-width: 665px) 100vw, 665px\" \/><\/a><\/figure>\n\n\n\n<ul><li><strong>Select the domain name<\/strong><\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/saedx.com\/blog\/wp-content\/uploads\/2021\/07\/3.jpg\" data-rel=\"penci-gallery-image-content\" ><img decoding=\"async\" loading=\"lazy\" width=\"1021\" height=\"706\" src=\"https:\/\/saedx.com\/blog\/wp-content\/uploads\/2021\/07\/3.jpg\" alt=\"\" class=\"wp-image-1469\" srcset=\"https:\/\/saedx.com\/blog\/wp-content\/uploads\/2021\/07\/3.jpg 1021w, https:\/\/saedx.com\/blog\/wp-content\/uploads\/2021\/07\/3-300x207.jpg 300w, https:\/\/saedx.com\/blog\/wp-content\/uploads\/2021\/07\/3-768x531.jpg 768w, https:\/\/saedx.com\/blog\/wp-content\/uploads\/2021\/07\/3-585x405.jpg 585w\" sizes=\"(max-width: 1021px) 100vw, 1021px\" \/><\/a><\/figure>\n\n\n\n<ul><li><strong>Scroll down until you see upload_max_filesize<\/strong><\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/saedx.com\/blog\/wp-content\/uploads\/2021\/07\/4.jpg\" data-rel=\"penci-gallery-image-content\" ><img decoding=\"async\" loading=\"lazy\" width=\"1017\" height=\"662\" src=\"https:\/\/saedx.com\/blog\/wp-content\/uploads\/2021\/07\/4.jpg\" alt=\"\" class=\"wp-image-1470\" srcset=\"https:\/\/saedx.com\/blog\/wp-content\/uploads\/2021\/07\/4.jpg 1017w, https:\/\/saedx.com\/blog\/wp-content\/uploads\/2021\/07\/4-300x195.jpg 300w, https:\/\/saedx.com\/blog\/wp-content\/uploads\/2021\/07\/4-768x500.jpg 768w, https:\/\/saedx.com\/blog\/wp-content\/uploads\/2021\/07\/4-585x381.jpg 585w\" sizes=\"(max-width: 1017px) 100vw, 1017px\" \/><\/a><\/figure>\n\n\n\n<ul><li><strong>Set the value you like followed with M character for Mega, in our case we set 2M.<\/strong><\/li><\/ul>\n\n\n\n<p><\/p>\n<\/div><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">2- Modify php.ini through upload file via FTP to WordPress root directory<\/h2>\n\n\n\n<p><br>The second way is to look for a php.ini file in the WordPress root directory, if <strong>php.ini <\/strong>file is not visible you need to create a new file instead.<\/p>\n\n\n\n<p><strong>1- Create a new file text editor like Notepad.<\/strong><br><strong>2- Copy the following code and paste it<\/strong><br><kbd><code>upload_max_filesize = 25M<br>post_max_size = 13M<br>memory_limit = 15M<\/code><\/kbd><br><strong>3- Save it as php.ini<\/strong><br><strong>4- Upload that php.ini file using FTP to the same root folder.<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/saedx.com\/blog\/wp-content\/uploads\/2021\/07\/5.png\" data-rel=\"penci-gallery-image-content\" ><img decoding=\"async\" loading=\"lazy\" width=\"384\" height=\"319\" src=\"https:\/\/saedx.com\/blog\/wp-content\/uploads\/2021\/07\/5.png\" alt=\"\" class=\"wp-image-1471\" srcset=\"https:\/\/saedx.com\/blog\/wp-content\/uploads\/2021\/07\/5.png 384w, https:\/\/saedx.com\/blog\/wp-content\/uploads\/2021\/07\/5-300x249.png 300w\" sizes=\"(max-width: 384px) 100vw, 384px\" \/><\/a><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">3- Edit Functions.php File<\/h2>\n\n\n\n<p><br>The last way to reduce the upload size limits is by adding these lines of code in the functions.php file of your theme.<br><code>@ini_set( 'upload_max_size' , '2M' );<br>@ini_set( 'post_max_size', '2M');<br>@ini_set( 'max_execution_time', '300' );<\/code><br>but keep in mind that if you change the WP theme then the max upload size will return to its default values until you edit the functions.php file of the new theme, because of that we recommend edit max upload via PHP.ini if it was possible.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you are building a WordPress website for your clients that you host their website in your VPS or dedicated server you may need to prevent them from uploading large&hellip;<\/p>\n","protected":false},"author":1,"featured_media":1472,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","footnotes":""},"categories":[11],"tags":[],"jetpack_featured_media_url":"https:\/\/saedx.com\/blog\/wp-content\/uploads\/2021\/07\/saedx-blog-featured-76.jpg","jetpack_shortlink":"https:\/\/wp.me\/p3wRFx-nC","_links":{"self":[{"href":"https:\/\/saedx.com\/blog\/wp-json\/wp\/v2\/posts\/1464"}],"collection":[{"href":"https:\/\/saedx.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/saedx.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/saedx.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/saedx.com\/blog\/wp-json\/wp\/v2\/comments?post=1464"}],"version-history":[{"count":2,"href":"https:\/\/saedx.com\/blog\/wp-json\/wp\/v2\/posts\/1464\/revisions"}],"predecessor-version":[{"id":1473,"href":"https:\/\/saedx.com\/blog\/wp-json\/wp\/v2\/posts\/1464\/revisions\/1473"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/saedx.com\/blog\/wp-json\/wp\/v2\/media\/1472"}],"wp:attachment":[{"href":"https:\/\/saedx.com\/blog\/wp-json\/wp\/v2\/media?parent=1464"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/saedx.com\/blog\/wp-json\/wp\/v2\/categories?post=1464"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/saedx.com\/blog\/wp-json\/wp\/v2\/tags?post=1464"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}