Skip Navigation

[Resolved] Removing post type from permalink

This support ticket is created 7 years, 6 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 9 replies, has 6 voices.

Last updated by zacharyL 7 years, 6 months ago.

Assisted by: Minesh.

Author
Posts
#442305

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!!

#442702

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

#442783

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!

#442788
perma.png

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

#442807

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/

#442830

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!

#480401

Super useful post - had the same issue and the solution worked. Thank you!

DB

#496341

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'

#613314

PZ

How to see hidden links?

#1632327

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.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.