Make WordPress Core

Opened 20 months ago

Last modified 10 months ago

#36423 new feature request

Constant in wp-config.php to disable uploads

Reported by: stevegrunwell Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Upload Keywords:
Focuses: Cc:


During a conversation with @ jasondewitt10up today, he asked if there was a wp-config.php constant he could define to disable uploads within WordPress (his specific use-case was in case the containerized filesystem went away, but I could also see uses during migration/content freezes, while performing some upgrades, etc.

I'd be interested to hear the core team's thoughts on a constant like DISABLE_FILE_UPLOAD, which would function in a similar fashion to DISALLOW_FILE_EDIT and DISALLOW_FILE_MODS. Is there a stance for or against more wp-config.php constants, or is it a "only if they really make sense and would be applicable for a large % of the install base" decision?

Change History (2)

#1 @aaronholbrook
20 months ago

I think this would be a good thing to be able to cleanly define with a single constant. +1

#2 @swissspidy
10 months ago

I personally think we should avoid adding too many constants because of backward compatibility problems and how they're not testable.

#38673 aims to introduce a wp_disallow_file_mods( $context ) function. Perhaps this could be used to conditionally disable file uploads?

Note: See TracTickets for help on using tickets.