Version Description
- fix for Wordpress 3.4.1 - category prefix was part of the generated URLs
Download this release
Release Info
Developer | FolioVision |
Plugin | FV Top Level Categories |
Version | 1.4 |
Comparing to | |
See all releases |
Code changes from version 1.3 to 1.4
- readme.txt +4 -5
- top-level-cats.php +19 -1
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: FolioVision
|
|
3 |
Donate link: http://foliovision.com/seo-tools/wordpress/plugins/fv-top-level-categories
|
4 |
Tags: categories, permalink
|
5 |
Requires at least: 3.2.1
|
6 |
-
Tested up to: 3.
|
7 |
Stable tag: trunk
|
8 |
|
9 |
This is a fix of Top Level Categories plugin for Wordpress 3.1. and above.
|
@@ -30,10 +30,6 @@ This plugin works also if you have a permalink structure like %postname% or %cat
|
|
30 |
|
31 |
== Frequently Asked Questions ==
|
32 |
|
33 |
-
= I get not found/404 errors on my posts/category URLs! =
|
34 |
-
|
35 |
-
Just visit Settings --> Permalinks to refresh the rewrite rules and the issues should disappear.
|
36 |
-
|
37 |
= How do I automatically redirect people from the old category permalink? =
|
38 |
|
39 |
We recommend that you use the [Redirection](http://wordpress.org/extend/plugins/redirection/) plugin and add your old an new category links, or use a Regex redirection rule. Make sure you change Tools -> Redirection -> Options -> URL Monitoring to "Don't monitor", as there is a [bug](http://wordpress.org/support/topic/plugin-redirection-my-homepage-is-being-redirected-to-a-page-need-some-help) in that feature (also in latest current version 2.2.5) - not related to FV Top Level Categories.
|
@@ -49,6 +45,9 @@ Make sure your categories have unique slugs - watch out for pages with the same
|
|
49 |
|
50 |
== Changelog ==
|
51 |
|
|
|
|
|
|
|
52 |
= 1.3 =
|
53 |
* for for flushing of rewrite rules on plugin activation in WP 3.3
|
54 |
|
3 |
Donate link: http://foliovision.com/seo-tools/wordpress/plugins/fv-top-level-categories
|
4 |
Tags: categories, permalink
|
5 |
Requires at least: 3.2.1
|
6 |
+
Tested up to: 3.4.1
|
7 |
Stable tag: trunk
|
8 |
|
9 |
This is a fix of Top Level Categories plugin for Wordpress 3.1. and above.
|
30 |
|
31 |
== Frequently Asked Questions ==
|
32 |
|
|
|
|
|
|
|
|
|
33 |
= How do I automatically redirect people from the old category permalink? =
|
34 |
|
35 |
We recommend that you use the [Redirection](http://wordpress.org/extend/plugins/redirection/) plugin and add your old an new category links, or use a Regex redirection rule. Make sure you change Tools -> Redirection -> Options -> URL Monitoring to "Don't monitor", as there is a [bug](http://wordpress.org/support/topic/plugin-redirection-my-homepage-is-being-redirected-to-a-page-need-some-help) in that feature (also in latest current version 2.2.5) - not related to FV Top Level Categories.
|
45 |
|
46 |
== Changelog ==
|
47 |
|
48 |
+
= 1.4 =
|
49 |
+
* fix for Wordpress 3.4.1 - category prefix was part of the generated URLs
|
50 |
+
|
51 |
= 1.3 =
|
52 |
* for for flushing of rewrite rules on plugin activation in WP 3.3
|
53 |
|
top-level-cats.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: FV Top Level Categories
|
4 |
Plugin URI: http://foliovision.com/seo-tools/wordpress/plugins/fv-top-level-categories
|
5 |
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>
|
6 |
-
Version: 1.
|
7 |
Author: Foliovision
|
8 |
Author URI: http://foliovision.com/
|
9 |
*/
|
@@ -98,4 +98,22 @@ function fv_top_level_categories_request($query_vars) {
|
|
98 |
}
|
99 |
return $query_vars;
|
100 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
?>
|
3 |
Plugin Name: FV Top Level Categories
|
4 |
Plugin URI: http://foliovision.com/seo-tools/wordpress/plugins/fv-top-level-categories
|
5 |
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>
|
6 |
+
Version: 1.4
|
7 |
Author: Foliovision
|
8 |
Author URI: http://foliovision.com/
|
9 |
*/
|
98 |
}
|
99 |
return $query_vars;
|
100 |
}
|
101 |
+
|
102 |
+
add_filter('category_link', 'top_level_cats_remove_cat_base');
|
103 |
+
function top_level_cats_remove_cat_base($link) {
|
104 |
+
$category_base = get_option('category_base');
|
105 |
+
|
106 |
+
// WP uses "category/" as the default
|
107 |
+
if ($category_base == '')
|
108 |
+
$category_base = 'category';
|
109 |
+
|
110 |
+
// Remove initial slash, if there is one (we remove the trailing slash in the regex replacement and don't want to end up short a slash)
|
111 |
+
if (substr($category_base, 0, 1) == '/')
|
112 |
+
$category_base = substr($category_base, 1);
|
113 |
+
|
114 |
+
$category_base .= '/';
|
115 |
+
|
116 |
+
return preg_replace('|' . $category_base . '|', '', $link, 1);
|
117 |
+
}
|
118 |
+
|
119 |
?>
|