MainWP Code Snippets Extension v5.1.1
The MainWP Code Snippets Extension is a powerful PHP platform that enables you to execute php code and scripts on your child sites and view the output on your Dashboard.
Same brand
More from MainWP
MainWP Domain Monitor Extension
by MainWP
MainWP Domain Monitor Extension lets you keep a watchful eye on your domains. It alerts you via email when monitored domains are nearing expiration.
MainWP SSL Monitor Extension
by MainWP
MainWP SSL Monitor ExtensionWatch your SSL Certificates access all your WordPress sites.
MainWP Database Updater Extension
by MainWP
MainWP Database Updater Extension is designed for updating the databases of two popular WordPress plugins - WooCommerce and Elementor.
The MainWP Code Snippets Extension is a powerful PHP platform that enables you to execute php code and scripts on your child sites and view the output on your Dashboard. Requires the MainWP Dashboard plugin.
MainWP Code Snippets Extension is an simple way to add code snippets to your child sites from one centralized location. No need to edit to your theme’s functions.php file or wp-config anymore!
Extension Description
MainWP Code Snippets Extension is an simple way to add code snippets to your child sites from one centralized location. No need to edit to your theme’s functions.php file or wp-config anymore!
Code snippet a small chunk of PHP code that can be inserted directly into your child sites. Sometimes they contain full functions, other times they simply modify an existing function.
This tool is for advanced users only. We only recommend utilizing it if you are experienced using PHP.
Create And Execute Your Own PHP Code Snippets Across Your Sites
With this Extension you can execute tasks like synchronizing the settings of a plugin, changing the content of any posts , updating widgets or just get post counts across your network and all of this is handled from your Dashboard.
The MainWP Code Snippet Extension allows you to run code in three ways:
1. Have a Code Snippet execute a function on the Child site.
You would use this option to make actual changes on your child sites. For example, if you wanted to customize the admin footer across different sites in your network you would use this option.
Show full descriptionShow less
2. Have a Code Snippet return information from a Child site.
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.
3. Have a Code Snippet edit the wp-config.php file on a Child site.
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 cron and much more!
The Power is in Your Hands!
This Extension gives you immense freedom when managing your child sites, here are just a few of useful things you can accomplish using Code Snippets:
- Disable theme, plugin editor and plugin, core updates
- Disable CRON job feature
- Set auto-save interval
- Block external requests
- Increase WordPress memory limit
- Protect WordPress against malicious URL requests
Want to see even more? Pop on over wpfunction.me or WPSnipp and jump start your imagination with even more things you can do with Code Snippets
The possibilities are endless, the only limitation is your imagination…
We even include a few pre-coded snippets to get you started.
Save and Use Your Favorite Snippets Unlimited Number of Times
Wouldn’t it be good if you could save your favorite snippets and run them on multiple sites when needed, all with just a few clicks? MainWP Code Snippets Extension provides you ability to Save your snippets and use them again and again whenever you need them.
Extend functionality of your child sites
Use code snippets as a mini-plugins and reduce load on your sites.
Speed up your WordPress maintenance process
Clear trash, update setting, set redirections, and much more with Code Snippets.
Save code snippets and re-run them whenever needed
Save your favorite Snippets and re-run them whenever needed.
Run code snippets on multiple sites simultaneously
Simultaneously run functions on any site you want
Recent releases
Release history
- Corrected the Code Snippets table installer to always define the auto-increment ID as a primary key.
View changelog
- Security: Improved code snippet database handling with prepared queries, sanitized values, and stricter user scoping.
- Security: Strengthened AJAX input and output handling to improve protection against malformed or unsafe requests.
- Dev: Refactored core database methods, including install, update_codesnippet, get_codesnippet_by, and remove_codesnippet, for safer and more consistent data handling.
- Dev: Refactored the extension structure with clearer return semantics, improved docblocks, singleton patterns, and updated build files for better maintainability.
- Corrected formatting of default snippet code.
- Ensured default snippet descriptions and data are properly migrated during upgrades.
- Code folding UI and fold keymap support.
- Autocompletion and automatic bracket closing in the code editor.
- Natural Tab indentation support in the code editor.
- PHP pre-save syntax validation to help catch common syntax errors before saving snippets.
- Added a new clients column to the Code Snippets database table to support client-based snippet organization.
- Reworked the snippet editor layout with a cleaner, more modern interface.
- Moved snippet settings above the code editor for easier access while editing snippets.
- Compacted snippet action buttons to reduce visual clutter in the editor area.
- Replaced the snippet type radio buttons with a pill-style selector for a clearer editing experience.
- Improved the saved snippets table by combining snippet titles and descriptions into a single, more readable column.
- Replaced plain text snippet type indicators with colored labels for better visibility in the saved snippets table.
- Refined multiple text strings for clearer and more consistent wording.
- Improved snippet options handling, selection normalization, and snippet type validation for better reliability.
- Improved snippet run UI rendering for a cleaner and more consistent user experience.
- Replaced the legacy CodeMirror 5 editor with a new CodeMirror 6 bundle.
- Improved internal utility handling with a safer rand_string method and a more user-friendly time_elapsed_string helper.
View changelog
- An issue with saving the snippets table state.
- Localization support.
- Removed excessive navigation menu on the extension page.
Frequently asked questions
Is MainWP - Code Snippets Extension GPL licensed?
What is the latest version of MainWP - Code Snippets Extension?
How much does MainWP - Code Snippets Extension cost on GPLCoffee?
Is MainWP - Code Snippets Extension safe to download?
Auto-updates included
Install it once, update automatically.
The GPLC Connector installs this plugin from your wp-admin and rolls out new versions to your connected sites - up to 25. Included with 12-month and Geek Lifetime plans (plus legacy 6-month).