Skip to content

Commit 16c93e9

Browse files
committed
All: Remove global $jquery_redirects from mu-plugins/redirect.php
Clean up the code to not involve a global variable for this string.
1 parent a76f40c commit 16c93e9

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

mu-plugins/redirects.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@
44
* Description: Adds custom XML-RPC methods to control redirection.
55
*/
66

7-
$jquery_redirects = 'jquery_redirects';
8-
97
add_filter( 'template_redirect', function() {
10-
global $jquery_redirects;
11-
128
// Only handle 404 Not Found
139
if ( !is_404() ) {
1410
return;
@@ -17,7 +13,7 @@
1713
$url = trailingslashit( $_SERVER[ 'REQUEST_URI' ] );
1814

1915
// Check for redirects stored in the transients
20-
$transient = get_option( $jquery_redirects );
16+
$transient = get_option( 'jquery_redirects' );
2117

2218
if ( $transient && !empty( $transient[ $url ] ) ) {
2319
wp_redirect( $transient[ $url ], 301 );
@@ -31,7 +27,6 @@
3127

3228
function jq_set_redirects( $args ) {
3329
global $wp_xmlrpc_server;
34-
global $jquery_redirects;
3530

3631
// Authenticate
3732
$username = $args[ 1 ];
@@ -42,5 +37,5 @@ function jq_set_redirects( $args ) {
4237
}
4338

4439
// Store redirects
45-
return update_option( $jquery_redirects, json_decode( $args[ 3 ], true ) );
40+
return update_option( 'jquery_redirects', json_decode( $args[ 3 ], true ) );
4641
}

0 commit comments

Comments
 (0)