Close

Remove slug even if in permalink structure

Take a look at it, now it no longer works in most recent versions of WordPress after 3.5 installs.

Change above line to

But now, it wont work adding only these piece of code in functions.php file because, we have to keep in mind that it will bring conflict if slug of custom post type and page or post may become same.

So what we will do is first remove the slug from the permalink by adding this single piece of code in functions.php.

 

And now if you visit the page you will get Page Not Found Error because its not enough.

Why ?

Because WordPress behave only post and page to work this way.

To make it work we need to add certain line of codes to tell WordPress to behave custom post type as page or post. To do this add these lines of codes in functions.php to make it work for custom post type as well.

Now go to Settings -> Permalinks and save changes without making any other changes in the permalinks section and you are good to go. Check your custom post type posts your slug have been removed from custom post type permalink structure.

If you have any other problem you can contact us via contact form from the contact us page. We will be happy to sort it out.