mirror of
https://github.com/szepeviktor/wordpress-website-lifecycle.git
synced 2025-08-20 19:21:05 +08:00
Add MU plugins
This commit is contained in:
parent
71e540afb9
commit
9094aa49bb
36 changed files with 733 additions and 0 deletions
23
mu-plugins/query-string-errors.php
Normal file
23
mu-plugins/query-string-errors.php
Normal file
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
// Log non-WordPress URL query strings.
|
||||
add_action(
|
||||
'parse_request',
|
||||
static function ($wp) {
|
||||
if (empty($_SERVER['QUERY_STRING'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (strpos($_SERVER['QUERY_STRING'], '+') !== false) {
|
||||
error_log(sprintf('Non-WordPress query string: plus_encoded_whitespace ("%s")', $_SERVER['QUERY_STRING']));
|
||||
return;
|
||||
}
|
||||
|
||||
if (preg_match('/%[[:xdigit:]]?[a-f]/', $_SERVER['QUERY_STRING']) === 1) {
|
||||
error_log(sprintf('Non-WordPress query string: lower_case_hexadecimal_digit ("%s")', $_SERVER['QUERY_STRING']));
|
||||
return;
|
||||
}
|
||||
},
|
||||
0,
|
||||
1
|
||||
);
|
Loading…
Add table
Add a link
Reference in a new issue