• Hi. My current post permalink is this:

    /%category/%postname%/

    I would like my category structure to be / (meaning if I wanted to view the category “random”, then the URL would be “https://site.com/random/”). I have tried putting “/” in the category permalink field, but it always reverts back to the default. Is what I’m describing possible?

Viewing 4 replies - 1 through 4 (of 4 total)
  • No, because categories need something in their URLs to distinguish them from pages.

    Thread Starter john010117

    (@john010117)

    Sigh… ok then. Thanks for the info.

    Anonymous User 179266

    (@anonymized-179266)

    yes it is possible. paste these code to your templates function.php so you dont need to change core files or install any plugin

    function kill_category_base($string)  {
    		 $string = str_replace('category/', '', $string);
    		 return $string;
    	}
    
    	add_filter('category_link', 'kill_category_base');

    thend leave blank your category permalink option. thats all.

    credits goest to: https://www.brianshoff.com/wordpress/category-base-removal-plugin.htm

    I modified the .htaccess so it can support category pagination and the rss feed permalinks.

    # remove the category suffix - by Joan Piedra
    # https://joanpiedra.com/wordpress/remove-category-suffix-permalink
    RewriteRule ^([^/.]+)/(page/([0-9]+)|feed)$ index.php/category/$1/$2 [L]
    
    # redirect everything else to wordpress
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php [L]

    More info at:
    https://joanpiedra.com/wordpress/remove-category-suffix-permalink/

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Category permalink’ is closed to new replies.