Submitted by Ambrose on Thu, 2014-08-14 06:12
[The information written in this article has proved to be wrong. See the follow-up to this article instead.]
Roots is pretty cool, but a major problem is the “activation” page. I’ve lost work more than once because I pressed the “Save” button by mistake, and my latest mistake involves having to ask someone to fix things up by FTP. It seriously provides no benefits at all and it has the potential and is very likely to do a whole lot of harm. So why is this dangerous page in there, and why is there no official way to completely take it out?
After breaking a site (by removing activation.php — bad idea), I poked around safely in my dev environment and found out that patching Roots in the following way will completely disable this dangerous “feature”. From WordPress’s point of view the activation page doesn’t even exist any more, even the activation link is gone, so this is perfect:
diff --git a/lib/activation.php b/lib/activation.php
index 4b677d6..a1b7c34 100644
--- a/lib/activation.php
+++ b/lib/activation.php
@@ -2,10 +2,12 @@
/**
* Theme activation
*/
+if (false) { // disable the dangerous "activation" page
if (is_admin() && isset($_GET['activated']) && 'themes.php' == $GLOBALS['pagenow']) {
wp_redirect(admin_url('themes.php?page=theme_activation_options'));
exit;
}
+} // disable the dangerous "activation" page
function roots_theme_activation_options_init() {
register_setting(
@@ -21,6 +23,7 @@ function roots_activation_options_page_capability($capability) {
add_filter('option_page_capability_roots_activation_options', 'roots_activation_options_page_capability');
function roots_theme_activation_options_add_page() {
+ return; // disable the dangerous "activation" page
$roots_activation_options = roots_get_theme_activation_options();
if (!$roots_activation_options) {