WP 404 Auto Redirect to Similar Post - Version 0.4.0.2

Version Description

  • Fixed sanitization bug
  • Fixed debug typo
Download this release

Release Info

Developer hwk-fr
Plugin Icon 128x128 WP 404 Auto Redirect to Similar Post
Version 0.4.0.2
Comparing to
See all releases

Code changes from version 0.4 to 0.4.0.2

readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://hwk.fr/
4
  Tags: 404, Redirect, 301, Similar Post, SEO, Broken Link, Webmaster Tools
5
  Requires at least: 4.0
6
  Tested up to: 4.7.4
7
- Stable tag: 0.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -46,6 +46,10 @@ This plugin will automatically redirect all your 404 to a similar post, based on
46
 
47
  == Changelog ==
48
 
 
 
 
 
49
  = 0.4 =
50
  * Revamped Code
51
  * Improved Speed
4
  Tags: 404, Redirect, 301, Similar Post, SEO, Broken Link, Webmaster Tools
5
  Requires at least: 4.0
6
  Tested up to: 4.7.4
7
+ Stable tag: 0.4.0.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
46
 
47
  == Changelog ==
48
 
49
+ = 0.4.0.2 =
50
+ * Fixed sanitization bug
51
+ * Fixed debug typo
52
+
53
  = 0.4 =
54
  * Revamped Code
55
  * Improved Speed
wp-404-auto-redirect-similar-post.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: WP 404 Auto Redirect to Similar Post
4
  * Description: Automatically Redirect any 404 to a Similar Post based on the Title, Post Type, Category & Taxonomy using 301 Redirects!
5
  * Author: hwk-fr
6
- * Version: 0.4
7
  * Author URI: http://hwk.fr
8
  */
9
 
@@ -31,8 +31,9 @@ function wp404arsp_query_setup($request){
31
  $path = pathinfo(urldecode(htmlspecialchars(strtok($request, '?'))));
32
  $path['filename'] = sanitize_title(pathinfo(basename($request), PATHINFO_FILENAME));
33
  $path['dirname'] = ltrim($path['dirname'], '/');
 
34
 
35
- if($path['dirname'] != '\\'){
36
 
37
  if(strpos($path['dirname'], '/') !== false){
38
  $path['directories'] = explode('/', $path['dirname']);
@@ -279,7 +280,7 @@ function wp404arsp_redirect($url = '', $debug = ''){
279
  $wp404arsp_settings = wp404arsp_settings();
280
 
281
  if(is_super_admin() && $wp404arsp_settings['debug']){
282
- echo "<pre>"; echo 'Redirect to: ' . $url . "</pre>";
283
 
284
  if(!empty($debug))
285
  echo "<pre>"; print_r($debug); echo "</pre>";
3
  * Plugin Name: WP 404 Auto Redirect to Similar Post
4
  * Description: Automatically Redirect any 404 to a Similar Post based on the Title, Post Type, Category & Taxonomy using 301 Redirects!
5
  * Author: hwk-fr
6
+ * Version: 0.4.0.2
7
  * Author URI: http://hwk.fr
8
  */
9
 
31
  $path = pathinfo(urldecode(htmlspecialchars(strtok($request, '?'))));
32
  $path['filename'] = sanitize_title(pathinfo(basename($request), PATHINFO_FILENAME));
33
  $path['dirname'] = ltrim($path['dirname'], '/');
34
+ $path['dirname'] = ltrim($path['dirname'], '\\');
35
 
36
+ if(!empty($path['dirname'])){
37
 
38
  if(strpos($path['dirname'], '/') !== false){
39
  $path['directories'] = explode('/', $path['dirname']);
280
  $wp404arsp_settings = wp404arsp_settings();
281
 
282
  if(is_super_admin() && $wp404arsp_settings['debug']){
283
+ echo "<pre>"; echo 'Redirect to: ' . ((!empty($url)) ? $url : '<span>Empty</span>') . "</pre>";
284
 
285
  if(!empty($debug))
286
  echo "<pre>"; print_r($debug); echo "</pre>";