Skip to content

Commit

Permalink
Merge pull request #9 from foliovision/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
foliovision committed Apr 7, 2016
2 parents 1ba113c + 2a2daca commit 1e4adbb
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions top-level-cats.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: FV Top Level Categories
Plugin URI: http://foliovision.com/seo-tools/wordpress/plugins/fv-top-level-categories
Description: Removes the prefix from the URL for a category. For instance, if your old category link was <code>/category/catname</code> it will now be <code>/catname</code>
Version: 1.8
Version: 1.8.1
Author: Foliovision
Author URI: http://foliovision.com/
Text Domain: fv_tlc
Expand Down Expand Up @@ -92,14 +92,13 @@ function fv_top_level_categories_tlc_redirect( $link ) {

$real_permalink = get_permalink($wp_query->queried_object_id);

if( FALSE === stripos($requested_url, $real_permalink) ) {

$bMached = preg_match('~/([^/:]+/?)$~',$real_permalink, $end_of_permalink);
if( $bMached && preg_match('~'.$end_of_permalink[1].'(.+)$~', $requested_url, $end_of_url) )
wp_redirect( $real_permalink . $end_of_url[1], 301 );
else
wp_redirect( $real_permalink, 301 );
die();
if( $real_permalink && FALSE === stripos($requested_url, $real_permalink) ) {
$bMached = preg_match('~/([^/:]+/?)$~',$real_permalink, $end_of_permalink);
if( $bMached && preg_match('~'.$end_of_permalink[1].'(.+)$~', $requested_url, $end_of_url) )
wp_redirect( $real_permalink . $end_of_url[1], 301 );
else
wp_redirect( $real_permalink, 301 );
die();
}
}

Expand Down

0 comments on commit 1e4adbb

Please sign in to comment.