Cannot Remove Subcategory in URL

So I have a URL that looks like this: https://domainname.com/coupons-category/categoryname
The “coupons-category” is coming from a custom post type called ‘Coupons’.

I want it to look like this: https://domainname.com/categoryname

What I have tried:
Settings > Permalinks > Custom Structure https://domainname.com/%category%/%postname%/
Category base = .

When I ‘Save Changes’ the radio button switches back to ‘Post Name’ instead of staying on ‘Custom Structure’.

I have tried using this:

'rewrite' => array(
	'slug'	=> 'categoryname',
        'with_front'  => false,
	  )

in the functions.php file, then went back to reset the Permalinks, but it didn’t make any difference.

Tried with Yoast: toggled the ‘Category URLs’ switch and still not difference.

I’ve tried using a redirect, but that’s pointless because it loads an Error 404 page.

I did try this plugin, but the plugin produced a ‘count’ error after attempting to use it, based upon the instructions provided.

Appreciate another set of eyes here.

Check if any plugin is causing the problem. Because normally the method you are using is perfect for removing the subcategory from the URL.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.