Remove “category” from permalink with add_rewrite_rule

I’am trying to remove the category part from the my category URLs, so that this

mydomain/category/knowledge

turns into this

mydomain/knowledge

I want to use add_rewrite_rule on this. Htaccess is not an option, neither is the Yoast SEO plugin.

I tried this, but I just can’t get it to work:

add_rewrite_rule( ‘(.+?)/?$’, ‘index.php?category_name=$matches[1]’, ‘top’ );

Any ideas how this could work?

Read more here:: Remove “category” from permalink with add_rewrite_rule

Leave a Reply

Your email address will not be published. Required fields are marked *