How to Quickly Debug Complicated WordPress Plugin & Theme Activation Procedures
As WordPress plugins and themes get more complicated, it’s becoming more and more challenging to debug their installation procedures. For simpler plugins, installation and activation events involve setting some default options, if even that. For larger plugins, it involves much more:
- Creating custom tables and populating them with demo content.
- Checking for other plugins and adjusting settings accordingly.
- Setting and resetting pointers and notifications depending on various environment variables.
- Showing onboarding guides.
Debugging and testing such complicated activation functions in an unknown environment affected by an unlimited amount of 3rd party code is hugely time-consuming.
One way to speed up and streamline the process is to use the free WordPress Reset plugin.
How Does It Help?
Every time you modify the activation code you need to retest it. That involves resetting the test environment in such a way that it simulates (as best as possible) the situation your users will have when they install the plugin – an environment that is clean of your custom tables, options, files and any other traces of your plugin.
WP Reset procures that environment in just one click. It resets the WP database back to its original, post-install state thus getting it rid of any custom data, options or transients. It also deletes all custom tables.
Sidenote: it only deletes tables that have the same prefix as your default WP tables. So any other tables or WP installations in that WP database are safe. Any files, regardless of their location also remain untouched.
Resetting takes less than a second on most installations. It takes more time to double-confirm the reset action than for the actual reset to take place.
That double-confirmation might annoy you but it understandable why it’s there. There is no undo! WP Reset makes no backups and there is no way to get your data back once a reset is done. Unless you have a back of your own, of course.
If you want to do things faster, we suggest using WP-CLI. The plugin has full support for it, and by running, “wp reset reset –yes” you can trigger the command without any additional confirmations.
What Happens After I Reset?
This is the best part! You don’t need to log in again. You don’t have to adjust anything or do any additional work. You’ll be logged out and logged in again and taken to the WP dashboard. That’s it! From there you can reactivate your plugin and re-test the activation code. Fast and simple – ideal for testing!
If you head over to the WP Reset site, you’ll see they have a lot more features planned that will further increase productivity. One of them is “post reset setup”. It’ll give you the option to select which plugins get re-activated after reset meaning you won’t need to activate them manually. Database diff function will provide a deep insight into what changed in the WP database compared to the default state. Very useful for debugging 3rd party plugins!
So, This Is for Devs Only?
WP Reset is primarily a development tool aimed at developers. Those who are not necessarily developers but do build their sites will find it useful too. For non-production environments, it’s an excellent tool for testing things and seeing how things work without having to spend much time with resetting WordPress.
- Easy and Exciting ways to Make Money Online - December 2, 2022
- How to Choose a eCommerce Development Company - November 29, 2022
- What Automation Can Do for Your Business: a Quick Overview - November 24, 2022
Where Should We Send
Your WordPress Deals & Discounts?
Subscribe to Our Newsletter and Get Your First Deal Delivered Instant to Your Email Inbox.