The plugin has a very simple code which strips the folders (cat1/cat2) from the permalink /cat1/cat2/lastcat/article.htm

add_filter('post_link', 'lastcategory_post_permalink', 10, 3); 

function lastcategory_post_permalink($permalink) {
    $lastCat = array_reverse(explode("/", $permalink));
    $permalink = get_bloginfo('url') . "/".$lastCat[1]."/".$lastCat[0];
    return $permalink;

But it doesn't create any redirect, so if the user tries to visit /cat1/cat2/lastcat/article.htm or lastcat/article.htm they both work without redirection.

Is there a proper hook to fix this problem?


This site is temporarily in read-only mode and not accepting new answers.

Browse other questions tagged .