Hi
im trying to get rid of the Types posttype name in the permalink.
instead
mydomain.com/posttype/postname
i want
mydomain.com/postname
is there any way to do it with toolset or do you have other suggestion?
("Pages" dont have their posttype either in the permalink, so it seems logical that other posttypes can be excepted too...)
Thanks!!
Minesh
Supporter
Languages:
English (English )
Timezone:
Asia/Kolkata (GMT+05:30)
Hello. Thank you for contacting the Toolset support.
Generally, you can alter the slug by using "Use a custom URL format" under "Rewrite" option, when editing your CPT (see attached).
=> hidden link
Following link may help you:
=> hidden link
Hello Minesh
Thanks! i would first like to try with the option within Toolset. I don't want anything before the page slug
mydomain.com/postname
I already did try with setting to "Use a custom format" and leave the field empty. This doesn't change anything.
Now i tried only with a /
doesn't work either, same result: mydomain.com/posttype/postname
is there a way to get to this mydomain.com/postname format in toolset? can you tell me what to enter in the custom format field?
Thanks!
correction. if i put only a /, it does show the correct link but unfortunately i get a 404 error. i do reset the permalinks by setting to default than back to
hidden link
Minesh
Supporter
Languages:
English (English )
Timezone:
Asia/Kolkata (GMT+05:30)
It needs rewrite custom rules to work and that needs custom programming that is unfortunately out of the scope of our support policy.
However I have nice workaround that will help you, you just need to follow the guidelines given in the following link. I suggest you should follow the following tutorial and try to resolve your issue.
=> hidden link
more:
=> http://wordpress.stackexchange.com/questions/203951/remove-slug-from-custom-post-type-post-urls
If you need custom programming work for your project, please feel free to contact our certified partners.
=> https://toolset.com/consultant/
OK! i got it working.
Steps:
In the custom posttype i set the URL-Format to /
this has the effect, that the post links show already correctly in the editor without posttype prepended. i think it replaces the first part of the code in the link you provided.
I copied only the code from position 4. from your Link to functions.php
hidden link
and changed/added the posttypes i need fixed on the "$query->set..." line.
Thats very useful because i often use custom posttypes just to have a good separation inside administrator and it's not necessary to show this in the link.
Thanks!
Super useful post - had the same issue and the solution worked. Thank you!
DB
Thanks from here as well!
Does somebody also has the case of having custom taxonomies used in custom posttypes - and want to have there a smart permalink structure, too?
Like : 'mypage.com/tea' instead of 'mypage.com/shop-category/tea'
It would be nice if I could see the hidden links that have the solution. It doesn't do anybody else any good if we can't see the bloody solution.