Fails when permalink has custom structure with static front (fix provided)
-
The URLs became inconsistent after activating this plugin.
The function
no_category_base_permastruct()
replaces the entire permalink structure instead of removing only the category base. For example, if my structure is/blog/%category%/%postname%/
the category structure is initially/blogs/category/%category%
. Removing the base with this plugin should make it/blogs/%category%
, but instead it was just%category%
.This could be fixed by including the existing
front
like so:function no_category_base_permastruct() { global $wp_rewrite, $wp_version; if (version_compare($wp_version, '3.4', '<')) { // For pre-3.4 support $wp_rewrite -> extra_permastructs['category'][0] = $wp_rewrite->front . '%category%'; } else { $wp_rewrite -> extra_permastructs['category']['struct'] = $wp_rewrite->front . '%category%'; } }
I didn’t test on a version less than 3.4 so I can’t guarantee prepending
front
will work for older versions.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Fails when permalink has custom structure with static front (fix provided)’ is closed to new replies.