Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dieppon/09dbe484c246f36f8121f59e00aa5529 to your computer and use it in GitHub Desktop.
Save dieppon/09dbe484c246f36f8121f59e00aa5529 to your computer and use it in GitHub Desktop.
Fixes 'Unauthorized access' on Bedrock WP installation.
diff --git a/settings.php b/settings.php
index 1b87a34..9308391 100755
--- a/settings.php
+++ b/settings.php
@@ -8,7 +8,7 @@
if($_SERVER['REQUEST_METHOD'] == 'POST' && !in_array($tab, ['test', 'log'])){
if(!$_POST['settings_nonce']
|| !wp_verify_nonce($_POST['settings_nonce'], 'wpreroute_save_settings')
- || $_POST['_wp_http_referer'] != '/wp-admin/admin.php?page=wp-reroute-email%2Fsettings.php') {
+ || basename( $_POST['_wp_http_referer'] ) != 'admin.php?page=wp-reroute-email%2Fsettings.php') {
print esc_html__('Unauthorized access.');
exit;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment