> ## Documentation Index
> Fetch the complete documentation index at: https://mainwp-docs-review-bulk-settings-manager-extension.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Code Snippets Overview

> WordPress Code Snippets for MainWP is a simple way to add code snippets to your Child Sites from one centralized location. No need to edit your theme's functions.php file or wp-config anymore!

<div id="addon-data" style={{display: 'none'}} data-title="Code Snippets" data-purchase-url="https://mainwp.com/extension/code-snippets/" data-pricing-tier="pro" data-bundle="MainWP Pro" data-addon-type="extension" data-version="5.0" data-developer="MainWP" data-changelog-url="https://mainwp.com/changelog/mainwp-code-snippets-extension/" data-owned-by="Jestart LLC" data-privacy-url="https://mainwp.com/mainwp-plugin-privacy-policy/" />

## What You'll Learn

* Understanding the three code snippet types
* Executing and saving code snippets
* Removing snippets from child sites
* Recovering from bad snippets
* Useful wp-config.php snippets

***

<Info>
  **Extension Add-on** - This add-on provides standalone functionality within MainWP Dashboard. No third-party plugins required.
</Info>

<iframe className="w-full aspect-video rounded-xl" src="https://www.youtube.com/embed/Bl7rJzGmNU0" title="Code Snippets - Video Tutorial" frameBorder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowFullScreen />

The [MainWP Code Snippets Extension](https://mainwp.com/extension/code-snippets/) is a simple way to add code snippets to your child sites from one centralized location. The code snippet is a small chunk of PHP code inserted directly into your child sites. Sometimes they contain full functions; other times, they modify an existing function.

<Warning>
  **This tool is recommended for advanced users only.** We only recommend utilizing it if you are an experienced PHP coder.
</Warning>

## Code Snippet Types

The MainWP Code Snippet Extension allows you to run code in three ways:

<AccordionGroup>
  <Accordion title="Execute on Child Sites" icon="play" defaultOpen>
    This type of snippet will add the snippet on your child site, and it will be executed on-site load. This type of snippets will be saved in your child site database and executed each time your child site is loaded. You would use this option to make actual changes to your child sites. For example, if you wanted to customize the admin footer across different sites in your network, you would use this option.
  </Accordion>

  <Accordion title="Return info from Child Sites" icon="arrow-right-from-bracket">
    This type of snippet will get the info from child sites and display it in the Output Display. This type of snippet will not be saved on your child sites. This option queries the child and returns the information to you. An example would be if you wanted to know the published post count of all of your sites.
  </Accordion>

  <Accordion title="Save to wp-config.php" icon="file-code">
    This type of snippets will be added to your child site wp-config.php file and saved only in that file. One of the most important files in your WordPress installation is the wp-config.php file. A Code Snippet in this section allows you to do things such as increase WordPress memory, block external requests, disable WP-Cron, and much more.
  </Accordion>
</AccordionGroup>

<Warning>
  MainWP is not responsible for the code that you run on your sites. Use this tool with extreme care and at your own risk. Run any code on a test site before releasing it on live sites. If you execute a bad code snippet and crash your child sites, you need to remove the code snippet from your sites.
</Warning>

## Remove a Code Snippet From a Broken Site

Code snippets can be removed directly from the Database. To do this,

<Steps>
  <Step title="Login in to your cPanel, locate the phpMyAdmin, and open your site database" />

  <Step title="Locate and open the wp_options table" />

  <Step title="Locate and remove the optionname = mainwpextsnippetse">
    Locate and remove the **option\_name = mainwp\_ext\_snippets\_enabled** row, or **option\_name = mainwp\_ext\_code\_snippets.**
  </Step>
</Steps>

**This will remove all code snippets that were applied using our Code Snippets extension.** If you use bad snippets that are saved to the WP-Config.php, the file will need to be edited manually!

## Execute a Code Snippet

### Execute a New Code Snippet

<Steps>
  <Step title="Login in to your MainWP Dashboard" />

  <Step title="Go to the MainWP > Add-ons > Code Snippets > Execute Snippet page">
    Go to the **MainWP > Add-ons > Code Snippets > Execute Snippet** page<img src="https://mintcdn.com/mainwp-docs-review-bulk-settings-manager-extension/SD-zZip7r7vAnK6Z/images/add-ons/code-snippets-options.jpg?fit=max&auto=format&n=SD-zZip7r7vAnK6Z&q=85&s=f4ceff0e865d5176bb777d6eba26f6ca" alt="MainWP Code Snippets > Snippet Options" data-og-width="1703" width="1703" data-og-height="890" height="890" data-path="images/add-ons/code-snippets-options.jpg" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/mainwp-docs-review-bulk-settings-manager-extension/SD-zZip7r7vAnK6Z/images/add-ons/code-snippets-options.jpg?w=280&fit=max&auto=format&n=SD-zZip7r7vAnK6Z&q=85&s=bc9a96a54ff9d9e15a92bf880f93291b 280w, https://mintcdn.com/mainwp-docs-review-bulk-settings-manager-extension/SD-zZip7r7vAnK6Z/images/add-ons/code-snippets-options.jpg?w=560&fit=max&auto=format&n=SD-zZip7r7vAnK6Z&q=85&s=36f109452ec0230a4f26678cf1d71134 560w, https://mintcdn.com/mainwp-docs-review-bulk-settings-manager-extension/SD-zZip7r7vAnK6Z/images/add-ons/code-snippets-options.jpg?w=840&fit=max&auto=format&n=SD-zZip7r7vAnK6Z&q=85&s=619063f5c0a8510e3610f03fc2e59dc4 840w, https://mintcdn.com/mainwp-docs-review-bulk-settings-manager-extension/SD-zZip7r7vAnK6Z/images/add-ons/code-snippets-options.jpg?w=1100&fit=max&auto=format&n=SD-zZip7r7vAnK6Z&q=85&s=c079bab05571904572834f5912422c68 1100w, https://mintcdn.com/mainwp-docs-review-bulk-settings-manager-extension/SD-zZip7r7vAnK6Z/images/add-ons/code-snippets-options.jpg?w=1650&fit=max&auto=format&n=SD-zZip7r7vAnK6Z&q=85&s=a5f52e9495b9e04fe105bcff8e6adaaa 1650w, https://mintcdn.com/mainwp-docs-review-bulk-settings-manager-extension/SD-zZip7r7vAnK6Z/images/add-ons/code-snippets-options.jpg?w=2500&fit=max&auto=format&n=SD-zZip7r7vAnK6Z&q=85&s=b2d0b2810cda70358d43a81e89de71e5 2500w" />
  </Step>

  <Step title="Enter a Snippet Title" />

  <Step title="Enter a Snippet Description (optional)" />

  <Step title="Select the snippet type" />

  <Step title="Select Child Sites where you want to execute the snippet">
    [Select Child Sites](/getting-started/mainwp-user-interface) where you want to execute the snippet **NOTE:** A snippet cannot be executed on both the selection of Sites and a selection of Tags. If it is already executed to either Sites or Tags, and you choose the other selection type, it will be removed from the existing selection.
  </Step>

  <Step title="Add your Code Snippet in the code editor">
    Add your Code Snippet in the code editor\[<img src="https://mintcdn.com/mainwp-docs-review-bulk-settings-manager-extension/SD-zZip7r7vAnK6Z/images/add-ons/code-snippets-editor.jpg?fit=max&auto=format&n=SD-zZip7r7vAnK6Z&q=85&s=fc9c13c6aea2831534352e41dfc38bde" alt="MainWP Code Snippets > Code Editor" data-og-width="1374" width="1374" data-og-height="599" height="599" data-path="images/add-ons/code-snippets-editor.jpg" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/mainwp-docs-review-bulk-settings-manager-extension/SD-zZip7r7vAnK6Z/images/add-ons/code-snippets-editor.jpg?w=280&fit=max&auto=format&n=SD-zZip7r7vAnK6Z&q=85&s=93c8263bcfe9225cbae011d01e8f4498 280w, https://mintcdn.com/mainwp-docs-review-bulk-settings-manager-extension/SD-zZip7r7vAnK6Z/images/add-ons/code-snippets-editor.jpg?w=560&fit=max&auto=format&n=SD-zZip7r7vAnK6Z&q=85&s=0b4731006cf84af1f462cd2bc5c961f1 560w, https://mintcdn.com/mainwp-docs-review-bulk-settings-manager-extension/SD-zZip7r7vAnK6Z/images/add-ons/code-snippets-editor.jpg?w=840&fit=max&auto=format&n=SD-zZip7r7vAnK6Z&q=85&s=ce0d3f62ba36f5072e93f74cc1531feb 840w, https://mintcdn.com/mainwp-docs-review-bulk-settings-manager-extension/SD-zZip7r7vAnK6Z/images/add-ons/code-snippets-editor.jpg?w=1100&fit=max&auto=format&n=SD-zZip7r7vAnK6Z&q=85&s=c33deb6840b195b1c80c7e84d1d653de 1100w, https://mintcdn.com/mainwp-docs-review-bulk-settings-manager-extension/SD-zZip7r7vAnK6Z/images/add-ons/code-snippets-editor.jpg?w=1650&fit=max&auto=format&n=SD-zZip7r7vAnK6Z&q=85&s=e645444436ac5d789388dc742bc28d3b 1650w, https://mintcdn.com/mainwp-docs-review-bulk-settings-manager-extension/SD-zZip7r7vAnK6Z/images/add-ons/code-snippets-editor.jpg?w=2500&fit=max&auto=format&n=SD-zZip7r7vAnK6Z&q=85&s=432a02e62aa364f000bb6a8f45d3ef1b 2500w" />
  </Step>

  <Step title="Click the Save & Execute Snippet button" />
</Steps>

### Execute a Saved Code Snippet

<Steps>
  <Step title="Login in to your MainWP Dashboard" />

  <Step title="Go to the MainWP > Add-ons > Code Snippets > Saved Snippets page" />

  <Step title="Locate the Code Snippet that you want to execute" />

  <Step title="Click the Load button">
    Click the **Load** button\[<img src="https://mintcdn.com/mainwp-docs-review-bulk-settings-manager-extension/SD-zZip7r7vAnK6Z/images/add-ons/code-snippets-load.jpg?fit=max&auto=format&n=SD-zZip7r7vAnK6Z&q=85&s=1dc72e3a7be6d62b6a3808c4c3d580a6" alt="MainWP Code Snippets > Load Snippet" data-og-width="1720" width="1720" data-og-height="610" height="610" data-path="images/add-ons/code-snippets-load.jpg" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/mainwp-docs-review-bulk-settings-manager-extension/SD-zZip7r7vAnK6Z/images/add-ons/code-snippets-load.jpg?w=280&fit=max&auto=format&n=SD-zZip7r7vAnK6Z&q=85&s=0166da80b666ea68ac102f4b0b3aabe9 280w, https://mintcdn.com/mainwp-docs-review-bulk-settings-manager-extension/SD-zZip7r7vAnK6Z/images/add-ons/code-snippets-load.jpg?w=560&fit=max&auto=format&n=SD-zZip7r7vAnK6Z&q=85&s=e6f1216a8edf5f48a4796222bc583492 560w, https://mintcdn.com/mainwp-docs-review-bulk-settings-manager-extension/SD-zZip7r7vAnK6Z/images/add-ons/code-snippets-load.jpg?w=840&fit=max&auto=format&n=SD-zZip7r7vAnK6Z&q=85&s=6476cb34f2cb03562c35b6ad82617477 840w, https://mintcdn.com/mainwp-docs-review-bulk-settings-manager-extension/SD-zZip7r7vAnK6Z/images/add-ons/code-snippets-load.jpg?w=1100&fit=max&auto=format&n=SD-zZip7r7vAnK6Z&q=85&s=c30475a79ee387a2047aa41a153a2e4c 1100w, https://mintcdn.com/mainwp-docs-review-bulk-settings-manager-extension/SD-zZip7r7vAnK6Z/images/add-ons/code-snippets-load.jpg?w=1650&fit=max&auto=format&n=SD-zZip7r7vAnK6Z&q=85&s=028a3a989a95a4619d3fd2f2d56ed17c 1650w, https://mintcdn.com/mainwp-docs-review-bulk-settings-manager-extension/SD-zZip7r7vAnK6Z/images/add-ons/code-snippets-load.jpg?w=2500&fit=max&auto=format&n=SD-zZip7r7vAnK6Z&q=85&s=264ad7102b4c29daeeb77f3f58a2953d 2500w" />
  </Step>

  <Step title="Once the Code Snippet loads, click the Save & Execute Snippet button" />
</Steps>

## Save a Code Snippet

### Save a New Code Snippet

<Steps>
  <Step title="Login in to your MainWP Dashboard" />

  <Step title="Go to the MainWP > Add-ons > Code Snippets > Execute Snippet page">
    Go to the **MainWP > Add-ons > Code Snippets > Execute Snippet** page<img src="https://mintcdn.com/mainwp-docs-review-bulk-settings-manager-extension/SD-zZip7r7vAnK6Z/images/add-ons/code-snippets-options.jpg?fit=max&auto=format&n=SD-zZip7r7vAnK6Z&q=85&s=f4ceff0e865d5176bb777d6eba26f6ca" alt="MainWP Code Snippets > Snippet Options" data-og-width="1703" width="1703" data-og-height="890" height="890" data-path="images/add-ons/code-snippets-options.jpg" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/mainwp-docs-review-bulk-settings-manager-extension/SD-zZip7r7vAnK6Z/images/add-ons/code-snippets-options.jpg?w=280&fit=max&auto=format&n=SD-zZip7r7vAnK6Z&q=85&s=bc9a96a54ff9d9e15a92bf880f93291b 280w, https://mintcdn.com/mainwp-docs-review-bulk-settings-manager-extension/SD-zZip7r7vAnK6Z/images/add-ons/code-snippets-options.jpg?w=560&fit=max&auto=format&n=SD-zZip7r7vAnK6Z&q=85&s=36f109452ec0230a4f26678cf1d71134 560w, https://mintcdn.com/mainwp-docs-review-bulk-settings-manager-extension/SD-zZip7r7vAnK6Z/images/add-ons/code-snippets-options.jpg?w=840&fit=max&auto=format&n=SD-zZip7r7vAnK6Z&q=85&s=619063f5c0a8510e3610f03fc2e59dc4 840w, https://mintcdn.com/mainwp-docs-review-bulk-settings-manager-extension/SD-zZip7r7vAnK6Z/images/add-ons/code-snippets-options.jpg?w=1100&fit=max&auto=format&n=SD-zZip7r7vAnK6Z&q=85&s=c079bab05571904572834f5912422c68 1100w, https://mintcdn.com/mainwp-docs-review-bulk-settings-manager-extension/SD-zZip7r7vAnK6Z/images/add-ons/code-snippets-options.jpg?w=1650&fit=max&auto=format&n=SD-zZip7r7vAnK6Z&q=85&s=a5f52e9495b9e04fe105bcff8e6adaaa 1650w, https://mintcdn.com/mainwp-docs-review-bulk-settings-manager-extension/SD-zZip7r7vAnK6Z/images/add-ons/code-snippets-options.jpg?w=2500&fit=max&auto=format&n=SD-zZip7r7vAnK6Z&q=85&s=b2d0b2810cda70358d43a81e89de71e5 2500w" />
  </Step>

  <Step title="Enter a Snippet Title" />

  <Step title="Enter a Snippet Description (optional)" />

  <Step title="Select the snippet type" />

  <Step title="Select Child Sites where you plan to save the snippet">
    [Select Child Sites](/getting-started/mainwp-user-interface) where you plan to save the snippet **NOTE:** A snippet cannot be saved on both the selection of sites and a selection of tags. If it is already saved to either sites or tags, and you choose the other selection type, it will be removed from the existing selection.
  </Step>

  <Step title="Add your Code Snippet in the code editor">
    Add your Code Snippet in the code editor\[<img src="https://mintcdn.com/mainwp-docs-review-bulk-settings-manager-extension/SD-zZip7r7vAnK6Z/images/add-ons/code-snippets-editor.jpg?fit=max&auto=format&n=SD-zZip7r7vAnK6Z&q=85&s=fc9c13c6aea2831534352e41dfc38bde" alt="MainWP Code Snippets > Code Editor" data-og-width="1374" width="1374" data-og-height="599" height="599" data-path="images/add-ons/code-snippets-editor.jpg" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/mainwp-docs-review-bulk-settings-manager-extension/SD-zZip7r7vAnK6Z/images/add-ons/code-snippets-editor.jpg?w=280&fit=max&auto=format&n=SD-zZip7r7vAnK6Z&q=85&s=93c8263bcfe9225cbae011d01e8f4498 280w, https://mintcdn.com/mainwp-docs-review-bulk-settings-manager-extension/SD-zZip7r7vAnK6Z/images/add-ons/code-snippets-editor.jpg?w=560&fit=max&auto=format&n=SD-zZip7r7vAnK6Z&q=85&s=0b4731006cf84af1f462cd2bc5c961f1 560w, https://mintcdn.com/mainwp-docs-review-bulk-settings-manager-extension/SD-zZip7r7vAnK6Z/images/add-ons/code-snippets-editor.jpg?w=840&fit=max&auto=format&n=SD-zZip7r7vAnK6Z&q=85&s=ce0d3f62ba36f5072e93f74cc1531feb 840w, https://mintcdn.com/mainwp-docs-review-bulk-settings-manager-extension/SD-zZip7r7vAnK6Z/images/add-ons/code-snippets-editor.jpg?w=1100&fit=max&auto=format&n=SD-zZip7r7vAnK6Z&q=85&s=c33deb6840b195b1c80c7e84d1d653de 1100w, https://mintcdn.com/mainwp-docs-review-bulk-settings-manager-extension/SD-zZip7r7vAnK6Z/images/add-ons/code-snippets-editor.jpg?w=1650&fit=max&auto=format&n=SD-zZip7r7vAnK6Z&q=85&s=e645444436ac5d789388dc742bc28d3b 1650w, https://mintcdn.com/mainwp-docs-review-bulk-settings-manager-extension/SD-zZip7r7vAnK6Z/images/add-ons/code-snippets-editor.jpg?w=2500&fit=max&auto=format&n=SD-zZip7r7vAnK6Z&q=85&s=432a02e62aa364f000bb6a8f45d3ef1b 2500w" />
  </Step>

  <Step title="Click the Save Snippet button" />
</Steps>

### Edit a Saved Code Snippet

<Steps>
  <Step title="Login in to your MainWP Dashboard" />

  <Step title="Go to the MainWP > Add-ons > Code Snippets > Saved Snippets page" />

  <Step title="Locate the Code Snippet that you want to edit" />

  <Step title="Click the Load button">
    Click the **Load** button \[<img src="https://mintcdn.com/mainwp-docs-review-bulk-settings-manager-extension/SD-zZip7r7vAnK6Z/images/add-ons/code-snippets-load.jpg?fit=max&auto=format&n=SD-zZip7r7vAnK6Z&q=85&s=1dc72e3a7be6d62b6a3808c4c3d580a6" alt="MainWP Code Snippets > Load Snippet" data-og-width="1720" width="1720" data-og-height="610" height="610" data-path="images/add-ons/code-snippets-load.jpg" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/mainwp-docs-review-bulk-settings-manager-extension/SD-zZip7r7vAnK6Z/images/add-ons/code-snippets-load.jpg?w=280&fit=max&auto=format&n=SD-zZip7r7vAnK6Z&q=85&s=0166da80b666ea68ac102f4b0b3aabe9 280w, https://mintcdn.com/mainwp-docs-review-bulk-settings-manager-extension/SD-zZip7r7vAnK6Z/images/add-ons/code-snippets-load.jpg?w=560&fit=max&auto=format&n=SD-zZip7r7vAnK6Z&q=85&s=e6f1216a8edf5f48a4796222bc583492 560w, https://mintcdn.com/mainwp-docs-review-bulk-settings-manager-extension/SD-zZip7r7vAnK6Z/images/add-ons/code-snippets-load.jpg?w=840&fit=max&auto=format&n=SD-zZip7r7vAnK6Z&q=85&s=6476cb34f2cb03562c35b6ad82617477 840w, https://mintcdn.com/mainwp-docs-review-bulk-settings-manager-extension/SD-zZip7r7vAnK6Z/images/add-ons/code-snippets-load.jpg?w=1100&fit=max&auto=format&n=SD-zZip7r7vAnK6Z&q=85&s=c30475a79ee387a2047aa41a153a2e4c 1100w, https://mintcdn.com/mainwp-docs-review-bulk-settings-manager-extension/SD-zZip7r7vAnK6Z/images/add-ons/code-snippets-load.jpg?w=1650&fit=max&auto=format&n=SD-zZip7r7vAnK6Z&q=85&s=028a3a989a95a4619d3fd2f2d56ed17c 1650w, https://mintcdn.com/mainwp-docs-review-bulk-settings-manager-extension/SD-zZip7r7vAnK6Z/images/add-ons/code-snippets-load.jpg?w=2500&fit=max&auto=format&n=SD-zZip7r7vAnK6Z&q=85&s=264ad7102b4c29daeeb77f3f58a2953d 2500w" />
  </Step>

  <Step title="Once the Code Snippet loads, edit wanted details" />

  <Step title="Click the Save Snippet button" />
</Steps>

## Remove a Code Snippet From Child Sites

<Steps>
  <Step title="Login in to your MainWP Dashboard" />

  <Step title="Go to the MainWP > Add-ons > Code Snippets > Saved Snippets page" />

  <Step title="Locate the Code Snippet that you want to remove from your child sites" />

  <Step title="Click the Load button" />

  <Step title="Once the Code Snippet loads, unselect child sites where you want to remove the snippet">
    Once the Code Snippet loads, unselect child sites where you want to remove the snippet
  </Step>

  <Step title="Click the Save & Execute Snippet button." />
</Steps>

This process will remove the snippet from all your site and re-add it only on sites that are still selected. This method is recommended in case you want to keep your snippet saved in the Save Snippets list so it can be used again in the future. If you want to remove the snippet from all child sites, you can un-check all sites and click the **Save & Execute** **Snippet** button.

## 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 it on live sites. In case you damage your site by using a bad code snippet, read [this](#remove-a-code-snippet-from-child-sites) to see how to fix it.

### Delete rows in the wp\_mainwp\_stream\_meta and wp\_mainwp\_stream tables

This can be useful if the wp\_mainwp\_stream\_meta and wp\_mainwp\_stream tables have grown large in size. To prevent them from growing this large in the future, consider lowering the number of days for which the records are kept. **NOTE:** This will delete all records in these two tables, which means that the Pro Reports reports will not have any information about events prior to this deletion.

*When running the script, make sure to select **Return info from Child Sites**.*

```php theme={null}
global $wpdb;
$wpdb->query( "TRUNCATE TABLE {$wpdb->mainwp_stream}" );
$wpdb->query( "TRUNCATE TABLE {$wpdb->mainwp_streammeta}" );
```

### Change the value of "Keep Records for" in MainWP Child Reports plugin

<img src="https://mintcdn.com/mainwp-docs-review-bulk-settings-manager-extension/SD-zZip7r7vAnK6Z/images/add-ons/code-snippets-return-info.png?fit=max&auto=format&n=SD-zZip7r7vAnK6Z&q=85&s=c7e4396c11a59dedba88e1b36714356f" alt="Code Snippets execute action with Return info from Child Sites option" width="1562" height="518" data-path="images/add-ons/code-snippets-return-info.png" />

*When running the script, make sure to select **Return info from Child Sites**.*

```php theme={null}
global $wpdb;

$option = get_option( 'wp_mainwp_stream' );

if ( $option && isset( $option['general_records_ttl'] ) ) {
    $option['general_records_ttl'] = 31; // New desired value (e.g., 30 days)
    update_option( 'wp_mainwp_stream', $option );
}
```

### 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.*

```php theme={null}
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.*

```php theme={null}
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.*

```php theme={null}
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.*

```php theme={null}
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.*

```php theme={null}
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.*

```php theme={null}
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.*

```php theme={null}
define( 'WP_AUTO_UPDATE_CORE', false );
```

### Protect WordPress against malicious URL requests

*This snippet has to be saved to the **functions.php** file so be sure to select the "Execute on Child Sites" options when executing the snippet.*

```php theme={null}
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](http://wpsnip.com/)

***

## Related Resources

* [Development Add-ons](/add-ons/development) - Browse all development tools
* [Detect the Essential Plugin wp-config.php compromise](/add-ons/development/detect-wpos-analytics-wp-config-compromise) - Use a read-only snippet to check child sites for known compromise indicators
* [White Label Extension](/add-ons/agency/white-label-extension) - Deploy filters to child sites
* [Bulk Settings Manager](/add-ons/administrative/bulk-settings-manager-extension) - Manage plugin settings
