You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -39,3 +39,6 @@ This plugin is developped on WordPress 3.4, with the constant WP_DEBUG to TRUE.
39
39
40
40
* Version 1.0 :
41
41
* First version stable
42
+
43
+
* Version 1.0.1 :
44
+
* Add filter "apply_filters( 'url_memory_redirect_request_uri', $_SERVER['REQUEST_URI'] );" to parse result request_uri before request in redirections table
$result_id = $wpdb -> get_var($wpdb -> prepare("SELECT post_id FROM $wpdb->url_redirect WHERE status = %d AND path = %s", 0, $_SERVER['REQUEST_URI']));
30
-
if ($result_id!= false && (int)$result_id > 0) {
31
-
$result = get_post($result_id);
32
-
if ($result -> post_status!= 'publish') {
34
+
$result_id = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM $wpdb->url_redirect WHERE status = %d AND path = %s", 0, $request_uri ) );
35
+
if (false!= $result_id && (int)$result_id > 0) {
36
+
$result = get_post($result_id);
37
+
if ('publish' != $result->post_status ) {
33
38
returnfalse;
34
39
}
35
40
36
41
// Test is valid redirect exist ?
37
-
$counter = $wpdb -> get_var($wpdb -> prepare("SELECT COUNT(post_id) FROM $wpdb->url_redirect WHERE status = %d AND post_id = %d", 1, $result_id));
38
-
if ( $counter == 1 ) {
39
-
wp_redirect(get_permalink($result_id), 301);
42
+
$counter = $wpdb->get_var($wpdb->prepare("SELECT COUNT(post_id) FROM $wpdb->url_redirect WHERE status = %d AND post_id = %d", 1, $result_id ) );
43
+
if ( 1 == $counter ) {
44
+
wp_redirect(get_permalink($result_id), 301);
40
45
exit();
41
46
}
42
47
}
43
-
48
+
44
49
returnfalse;
45
50
}
46
51
47
52
/**
48
53
* Hook call for delete url redirection of deleted post
@@ -38,4 +38,7 @@ This plugin is developped on WordPress 3.4, with the constant WP_DEBUG to TRUE.
38
38
== Changelog ==
39
39
40
40
* Version 1.0 :
41
-
* First version stable
41
+
* First version stable
42
+
43
+
* Version 1.0.1 :
44
+
* Add filter "apply_filters( 'url_memory_redirect_request_uri', $_SERVER['REQUEST_URI'] );" to parse result request_uri before request in redirections table
0 commit comments