From 456f63af45526be33586b3cec3f5b0e921530d3d Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Sat, 15 Oct 2022 08:23:24 +1000 Subject: [PATCH] Remove the default 'wp_maybe_grant_site_health_caps' filter. (#41) --- dist-web/wasm-worker.js | 10 ++++++++++ src/shared/wordpress.mjs | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/dist-web/wasm-worker.js b/dist-web/wasm-worker.js index dadf3d02..d6c6f28a 100644 --- a/dist-web/wasm-worker.js +++ b/dist-web/wasm-worker.js @@ -213,6 +213,16 @@ " ); + // DISABLE SITE HEALTH: + file_put_contents( + '${this.DOCROOT}/wp-includes/default-filters.php', + preg_replace( + '!add_filter[^;]+wp_maybe_grant_site_health_caps[^;]+;!i', + '', + file_get_contents('${this.DOCROOT}/wp-includes/default-filters.php') + ) + ); + // WORKAROUND: // The fsockopen transport erroneously reports itself as a working transport. Let's force // it to report it won't work. diff --git a/src/shared/wordpress.mjs b/src/shared/wordpress.mjs index a7d9efea..f06bb00b 100644 --- a/src/shared/wordpress.mjs +++ b/src/shared/wordpress.mjs @@ -137,6 +137,16 @@ export default class WordPress { .'add_filter( "option_siteurl", function($url) { return getenv("HOST") ?: file_get_contents(__DIR__."/../.absolute-url"); }, 10000 );' . "\n" ); + // DISABLE SITE HEALTH: + file_put_contents( + '${this.DOCROOT}/wp-includes/default-filters.php', + preg_replace( + '!add_filter[^;]+wp_maybe_grant_site_health_caps[^;]+;!i', + '', + file_get_contents('${this.DOCROOT}/wp-includes/default-filters.php') + ) + ); + // WORKAROUND: // The fsockopen transport erroneously reports itself as a working transport. Let's force // it to report it won't work.