0

I'm using custom post type with custom taxonomies for my website and currently my URL is as follows:

www.website.com/taxonomy_slug/taxonomy_category

So an example realworld URL would be:

www.website.com/kernal_category/filmmaking

  • The taxonomy slug is kernal_category
  • The taxonomy category is filmmaking

I want to remove the taxonomy slug so that the url would more simply read www.website.com/filmmaking however none of the changes I have tried work.

My current Permalink settings are set to wwww.website.com/%category%/ however I have tried changing this to anything else (including /%postname%/)and it seems to have no affect on my website URLs.

Could someone suggest the proper way of fixing this, and also highlight some possible obstacles that may be preventing this from working.

This link did not work for me - Remove Custom Taxonomy Slug from Permalink

1 Answer 1

0

Why don't you try to create a slug of your own. And then link it up to your desire things.

Just use this function:

function slugify($str){
$search = array('Ș', 'Ț', 'ş', 'ţ', 'Ş', 'Ţ', 'ș', 'ț', 'î', 'â', 'ă', 'Î', 'Â', 'Ă', 'ë', 'Ë');
$replace = array('s', 't', 's', 't', 's', 't', 's', 't', 'i', 'a', 'a', 'i', 'a', 'a', 'e', 'E');
$str = str_ireplace($search, $replace, strtolower(trim($str)));
$str = preg_replace('/[^\w\d-\ ]/', '', $str);
$str = str_replace(' ', '-', $str);
return (substr($str, -1) == '-' ? substr($str, 0, -1) : $str );
}

and provide the string into this function bingo! I did little bit customization in this function.

What I am saying is create a custom-field with custom-post-type then make it read-only. And put your desire link in there. Everything will be fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.