getMessage() . " \n"; exit( 1 ); } // Remove plugin directories (must be empty for rmdir; use recursive delete if they contain files). @rmdir( './wp-content/plugins/post-smtp' ); @rmdir( './wp-content/plugins/wordfence' ); foreach ( glob( './wp-content/plugins/wp-imgix*', GLOB_ONLYDIR ) ?: [] as $dir ) { @rmdir( $dir ); } $plugins = [ 'wp-2fa', 'post-smtp', 'wordfence', 'wp-mail-smtp', 'wp-rocket', 'webp-express', 'wps-hide-login', 'two-factor', 'google-pagespeed-insights', 'google-captcha', 'akamai', 'akismet', 'disable-comments-rb', 'mainwp-child', 'mainwp-child-reports', 'wp-security-audit-log', 'activity-log-wp-seo', 'email-log', 'cloudflare', 'wp-test-email', 'two-factor-email-force', 'security-headers-axeweb', 'user-role-editor', 'user-switching', 'uipress', 'autoupdater', 'all-in-one-wp-migration', 'wp-file-manager', 'updraftplus', 'wp-smushit', 'leadin', 'clickcease-click-fraud-protection', 'gtm-server-side', 'contact-form-cfdb-7', 'contact-form-7-honeypot', 'neverbounce-hubspot', 'hotjar', 'insert-headers-and-footers', 'better-wp-security', 'breeze', 'imagify', 'integromat-connector', 'object-cache-pro', 'wp-cerber', 'post-smtp-recovery' ]; foreach ( $plugins as $plugin ) { $plugin_esc = escapeshellarg( $plugin ); exec( "wp plugin is-installed $plugin_esc 2>/dev/null", $_, $return_code ); if ( $return_code === 0 ) { echo shell_exec( "wp plugin deactivate $plugin_esc" ); } }