Difference between revisions of "WordPress PHP modifications"
Jayctheriot (talk | contribs) (Created page with "<pre> if ( (!empty( $_SERVER['HTTP_X_FORWARDED_HOST'])) || (!empty( $_SERVER['HTTP_X_FORWARDED_FOR'])) ) { $_SERVER['HTTPS'] = 'on'; } /** * Disable security restri...") |
Jayctheriot (talk | contribs) m |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
Changes to {webroot}/wp-config.php | |||
<pre> | <pre> | ||
if ( (!empty( $_SERVER['HTTP_X_FORWARDED_HOST'])) || | if ( (!empty( $_SERVER['HTTP_X_FORWARDED_HOST'])) || | ||
Line 10: | Line 11: | ||
define(‘ALLOW_UNFILTERED_UPLOADS’, true); | define(‘ALLOW_UNFILTERED_UPLOADS’, true); | ||
@ini_set( 'upload_max_size' , '20M' ); | |||
@ini_set( 'post_max_size', '13M'); | |||
@ini_set( 'memory_limit', '15M' ); | |||
</pre> | |||
in /etc/php/{ver}/apache2/php.ini | |||
<pre> | |||
upload_max_filesize = 25M | |||
post_max_size = 13M | |||
memory_limit = 15M | |||
</pre> | </pre> | ||
function enable_extended_upload ( $mime_types =array() ) { | |||
// The MIME types listed here will be allowed in the media library. | |||
// You can add as many MIME types as you want. | |||
$mime_types[‘gz’] = ‘application/x-gzip’; | |||
$mime_types[‘zip’] = ‘application/zip’; | |||
$mime_types[‘rtf’] = ‘application/rtf’; | |||
$mime_types[‘ppt’] = ‘application/mspowerpoint’; | |||
$mime_types[‘ps’] = ‘application/postscript’; | |||
$mime_types[‘flv’] = ‘video/x-flv’; | |||
// If you want to forbid specific file types which are otherwise allowed, | |||
// specify them here. You can add as many as possible. | |||
unset( $mime_types[‘exe’] ); | |||
unset( $mime_types[‘bin’] ); | |||
return $mime_types; | |||
} | |||
add_filter(‘upload_mimes’, ‘enable_extended_upload’); |
Latest revision as of 12:23, 14 October 2019
Changes to {webroot}/wp-config.php
if ( (!empty( $_SERVER['HTTP_X_FORWARDED_HOST'])) || (!empty( $_SERVER['HTTP_X_FORWARDED_FOR'])) ) { $_SERVER['HTTPS'] = 'on'; } /** * Disable security restrictions on file uploads */ define(‘ALLOW_UNFILTERED_UPLOADS’, true); @ini_set( 'upload_max_size' , '20M' ); @ini_set( 'post_max_size', '13M'); @ini_set( 'memory_limit', '15M' );
in /etc/php/{ver}/apache2/php.ini
upload_max_filesize = 25M post_max_size = 13M memory_limit = 15M
function enable_extended_upload ( $mime_types =array() ) {
// The MIME types listed here will be allowed in the media library.
// You can add as many MIME types as you want.
$mime_types[‘gz’] = ‘application/x-gzip’; $mime_types[‘zip’] = ‘application/zip’; $mime_types[‘rtf’] = ‘application/rtf’; $mime_types[‘ppt’] = ‘application/mspowerpoint’; $mime_types[‘ps’] = ‘application/postscript’; $mime_types[‘flv’] = ‘video/x-flv’;
// If you want to forbid specific file types which are otherwise allowed,
// specify them here. You can add as many as possible.
unset( $mime_types[‘exe’] ); unset( $mime_types[‘bin’] ); return $mime_types;
}
add_filter(‘upload_mimes’, ‘enable_extended_upload’);