Skip to content

Instantly share code, notes, and snippets.

@iwek
Last active September 15, 2024 16:02
Show Gist options
  • Save iwek/7960079 to your computer and use it in GitHub Desktop.
Save iwek/7960079 to your computer and use it in GitHub Desktop.
Send WordPress Plugin Activation Errors to a File
<?php
add_action('activated_plugin','save_error');
function save_error(){
file_put_contents(ABSPATH. 'wp-content/plugins/PLUGIN_FOLDER/error.html', ob_get_contents());
}
?>
@shaunpalmer
Copy link

Star Trek Analogy (because why not?):
Think of this snippet as the USS Enterprise’s logbook. Whenever a new crew member (plugin) comes aboard, Captain WordPress makes a note of any strange occurrences. “Stardate 2024.09.15: Plugin ‘@ YourPlugin ’ activated. Spock raised an eyebrow. McCoy grumbled about missing semicolons. All systems nominal… for now.”
Remember, even in the vastness of code, there’s always room for improvement. 🚀 If you have any specific tweaks in mind or need further assistance, just let me know! Live long and debug! 🖖😄

Captain’s Log (Stardate 2024.09.15):

“Plugin ‘CleanSweep’ activated. Scotty grumbled about missing semicolons. Spock raised an eyebrow. All systems nominal… except for that pesky whitespace issue in line 42.”

“Scotty’s Scottish Accent” Flavor: error_log("Captain, I cannae change the laws of PHP! But I found a bug in the dilithium matrix (line 23).");

Feel free to adapt this snippet to your needs, and may your logs be as organized as a well-arranged bookshelf! 📚🔍
Engage warp drive to productivity… 🚀🖖

P.S. If you’d like, we can also discuss how Data’s cat, Spot, would handle PHP errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment