Useful Code Snippets

MainWP is not responsible for the code that you run on your sites.
Use this tool with extreme care and at your own risk. It is recommended that you run any code on a test site before releasing on live sites.
In case you damage your site by using a bad code snippet, read this document do to see how to fix it.

Disable theme, plugin editor and plugin, core updates

This snippet goes to the wp-config.php file of your child sites. Be sure to select the correct (3rd) option when using the code snippet.

define('DISALLOW_FILE_EDIT',true); // theme, plugin
define('DISALLOW_FILE_MODS',true); // core, plugin

Disable CRON job feature

This snippet goes to the wp-config.php file of your site. Be sure to select the correct (3rd) option when using the code snippet.

define('DISABLE_WP_CRON', true);

Set auto-save interval

This snippet goes to the wp-config.php file of your site. Be sure to select the correct (3rd) option when using the code snippet.

define('AUTOSAVE_INTERVAL', 200);

Block external requests

This snippet goes to the wp-config.php file of your site. Be sure to select the correct (3rd) option when using the code snippet.

define('WP_HTTP_BLOCK_EXTERNAL', true);
This Snippet will hide plugin and theme updates. Because of that, you won’t be able to see it in your Dashboard too.

Increase WordPress memory limit

This snippet goes to the wp-config.php file of your site. Be sure to select the correct (3rd) option when using the code snippet. 

define('WP_MEMORY_LIMIT', '95M');

Enable Debug Mode

This snippet goes to the wp-config.php file of your site. Be sure to select the correct (3rd) option when using the code snippet.

define( 'WP_DEBUG', true );

Disable All Core Updates

This snippet goes to the wp-config.php file of your site. Be sure to select the correct 3rd) option when using the code snippet.

define( 'WP_AUTO_UPDATE_CORE', false );

Protect WordPress against malicious URL requests

global $user_ID; if($user_ID) {
        if(!current_user_can('administrator')) {
                if (strlen($_SERVER['REQUEST_URI']) > 255 ||
                        stripos($_SERVER['REQUEST_URI'], "eval(") ||
                        stripos($_SERVER['REQUEST_URI'], "CONCAT") ||
                        stripos($_SERVER['REQUEST_URI'], "UNION+SELECT") ||
                        stripos($_SERVER['REQUEST_URI'], "base64")) {
                                @header("HTTP/1.1 414 Request-URI Too Long");
                                @header("Status: 414 Request-URI Too Long");
                                @header("Connection: Close");
                                @exit;
                }
        }
}

Source: WPSnip.com