I would like to know if its possible to remove URL structure for a custom post type. For example, I have 2 custom post types: portfolio and slider.
I want to keep URL structure for portfolio post type like this: mysite.com/portfolio/item-1 etc.
But I dont want URL structure for slider posts, since the slider will only be shown on the home page and I dont want visitors to be able to access it by going to mysite.com/slider/slide-1 for example. Is it possible?
Thanks in advance 🙂
WordPress forums post: http://wordpress.org/support/topic/no-url-structure-for-custom-post-type-1?replies=1
When you do register new custom post you’re using
register post type
, right? There are optionsAfter WordPress documentation:
Now go to Permalinks Settings and without changing anything – save change. It will rebuild your “routing”.
Such setup will disable your custom post from frontend.
I had similar problem, in my case I had custom post type like this:
and inside I’ve got a lot of posts, so of course this generated for me pages looks like:
BUT, I knew that in the future I’ll make websites there, so simple I made a redirection inside this custom post type webpages. So inside single-type.php I added:
So this simply redirect people to 404 page. Few weeks later, when I wanted to turn on these pages, I just deleted this code.
This is just a temporary workaround, but I hope it could help someone.