Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • I dunno, I’ve had luck getting rid of it. The way I got around is:

    1) open the file “category-template” in the “wp-includes” directory

    2) around line 41, between add "$catlink = str_replace('category/', '', $catlink);"

    3) the function should end up looking like this:

    function get_category_link($category_id) {
    	global $wp_rewrite;
    	$catlink = $wp_rewrite->get_category_permastruct();
    
    	if ( empty($catlink) ) {
    		$file = get_option('home') . '/';
    		$catlink = $file . '?cat=' . $category_id;
    	} else {
    		$category = &get_category($category_id);
    		$category_nicename = $category->category_nicename;
    
    		if ( $parent = $category->category_parent )
    			$category_nicename = get_category_parents($parent, false, '/', true) . $category_nicename . '/';
    
    		$catlink = str_replace('%category%', $category_nicename, $catlink);
    		$catlink = get_option('home') . trailingslashit($catlink);
    
    		//remove the uneeded name in link
    		$catlink = str_replace('category/', '', $catlink);
    	}
    	return apply_filters('category_link', $catlink, $category_id);
    }

    This removes the string “category” from category links, which seems to be unneeded. You can try it out by going to a category page before you make the change and remove the “category” from the URL, it seems to still work. This just makes it so that it isn’t included in the links generated by WordPress.

    If you want me to go into why this works and how regular expressions/mod_rewrite is setup on WordPress I can try, but I’ll just leave this bit of info for now.

    Thread Starter reidreid46

    (@reidreid46)

    Also, I just noticed that it might have something to do with the fact that I have a page with the slug “portfolio”. Is it getting confused?

    I’d like there to be a portfolio page that reads:
    “www.mysite.com/portfolio/”

    and then to have posts look like they’re in that section:
    “www.mysite.com/portfolio/êtegory%/%post_id%/”

Viewing 2 replies - 1 through 2 (of 2 total)