WordPress PHP modifications

From Jay's Cafe' Wiki
Revision as of 12:23, 14 October 2019 by Jayctheriot (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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’);