Skip to content

Commit b508319

Browse files
committed
Fix: remove performance rules from htaccess file on plugin deactivation
1 parent b1b88e8 commit b508319

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

includes/Performance.php

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -134,19 +134,24 @@ public function hooks() {
134134
add_filter( 'got_rewrite', '__return_true' );
135135
}
136136

137-
add_filter(
138-
'mod_rewrite_rules',
139-
function ( $content ) {
140-
add_action(
141-
'shutdown',
142-
function () {
143-
do_action( 'newfold_update_htaccess' );
144-
}
145-
);
146-
147-
return $content;
148-
}
149-
);
137+
if (
138+
isset( $_REQUEST['action'], $_REQUEST['plugin'] ) &&
139+
'activate' === $_REQUEST['action'] &&
140+
$_REQUEST['plugin'] === $this->container->plugin()->basename
141+
) {
142+
add_filter(
143+
'mod_rewrite_rules',
144+
function ( $content ) {
145+
add_action(
146+
'shutdown',
147+
function () {
148+
do_action( 'newfold_update_htaccess' );
149+
}
150+
);
151+
return $content;
152+
}
153+
);
154+
}
150155

151156
add_filter( 'action_scheduler_retention_period', array( $this, 'nfd_asr_default' ) );
152157
add_filter( 'action_scheduler_cleanup_batch_size', array( $this, 'nfd_as_cleanup_batch_size' ) );

0 commit comments

Comments
 (0)