Dive into Savings with MainWP - $50 OFF on our Yearly Plan!
👉 Hurry, before the deal fades to black! ⏰

Helpful Code Snippets for Deleting Transients & WordPress Plugins

Code Snippet - Remove Transients & Default Plugins for WordPress

Heads up: This page may include affiliate links. Read the full disclosure.

Code Snippets can be used to customize the functionality of your WordPress site without having to modify the core files of the platform. This is important because modifying core files can be risky and lead to compatibility issues with plugins and themes.

Code Snippet for Deleting Transients

Transients are a type of caching mechanism in WordPress that allows temporary data to be stored in the database with an expiration time. Transients are often used for expensive or time-consuming operations, such as database queries or API requests, that must be performed frequently.

Depending on the number of plugins running on the site and how often expired transients are deleted, transients can quickly end up bloating up the site’s options database table.

The cron event in WordPress core is set to delete expired transients every 24 hours. In this code snippet, we modify the cron event in the WordPress core delete_expired_transients so that it will run every 6 hours.

Modify WordPress Transients Cron

Bulk Deleting WordPress Plugins

If you are dealing with a client’s new or existing site with the Hello Dolly and Akismet plugins installed, you can utilize a code snippet to disable and remove both plugins. These plugins come as default in a fresh WordPress installation.

Usually, those plugins are not present if you use WP Toolkit by cPanel since you can select which plugins should be installed by default when creating a new WordPress installation.

To execute any action required on WordPress plugins from the MainWP Dashboard, you can utilize this code snippet and modify it accordingly for bulk plugin deletion or any other necessary task.

Delete Hello Dolly and Akismet Plugin

The Code Snippets is a powerful Extension for MainWP as it allows you to create, edit, delete, and execute custom code snippets on your Child Sites without directly modifying the theme or plugin files, saving you time and effort.

You can also organize your snippets into categories and search through them to quickly find what you need.

This makes it easier to maintain your sites and ensures that your customizations are not lost during updates.

Overall, the Code Snippets Extension is a powerful tool for developers and site owners who want to customize their Child Sites and streamline their workflow.

Useful Links

Looking for something?

Privacy laws apply to businesses that collect personal information. Since no personal information is collected by the MainWP plugins, no privacy laws apply to the MainWP plugins. This includes GDPR, UK DPA 2018, PIPEDA, Australia Privacy Act 1988, LGPD, PIPL, and other privacy laws.
Donata Stroink-Skillrud
Donata Stroink-Skillrud
President of Agency Attorneys

Your Download Is Just One Click Away

…or just download the plugin.

By entering your email, you agree to our Terms of Service and Privacy Policy.