Skip Navigation

[Fermé] Permalink structure for custom post types

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created Il y a 11 années et 6 mois. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 19:00 10:00 – 19:00 10:00 – 19:00 10:00 – 19:00 10:00 – 19:00 -
- - - - - - -

Supporter timezone: Europe/Madrid (GMT+01:00)

This topic contains 7 réponses, has 3 voix.

Last updated by Caridad Il y a 11 années et 6 mois.

Assisted by: Caridad.

Auteur
Publications
#21147

TJ

Hi,

I may be going crazy, but I'm quite sure when I initially set up a new custom post type 'jobs', the permalink structure for all posts (regardless of whether they're in the 'posts' or 'jobs' types) was unchanged - root/%postname%.

I tried changing the structure, allowing rewrites for all posts in the 'jobs' post type, which changed to root/jobs/%postname% as expected. Though dure to a conflict with a page now coming up as a 404 (root/jobs/closed), I changed it back. (As an aside, I'd have no need to change it back if there's a way to prevent this page from being blocked internally? It's a page, and a child of another page named Jobs. has_archive is set to false to allow the Jobs page to function - help here would be great also).

But... now all the permalinks in the 'jobs' type are root/?jobs=%postname%

I've tried changing all sorts of settings, but can't get the root/%postname% structure back for posts under the custom post type. Any ideas?

Thanks!

#21154

Dear TJ,

What you are seeing are the default permalinks. Go to Settings -> Permalinks in your WordPress Dashboard and set something different from the default. Besides that, I think you are having a conflict because you are using the same slug for the post type and for a page. Try changing the slug of the jobs post type to job and it should all work.

Please let me know if there is anything else that I can assist you with.

Regards,
Caridad

#21181

TJ

Thanks for your help CaridadZ.

Unfortunately the WP permalink structure is set to custom ( /%postname% ) not the default ( /?p=%ID%/ ). I've tried multiple permalink structures and have gone back to custom, but none affect the /?jobs= part of the permalink for that post type. It did seem to work fine before I tried the rewrite (a few times) withing Types, but now something seems to have locked in place. I get the feeling that by playing with the post type permalink settings too many times (in attempt to get the /jobs/closed page to show) I've cooked something, but I hope there's a more logical answer!

Also, regardless of the WP permalink structure, so long as rewrite is off, I also can't edit the post slugs in the 'jobs' type in the post edit screen. This is locked at /?jobs=%postname% and the 'edit slug' button is gone. I can edit the slug with quick edit, but the /?jobs= part is missing there, then seemingly automatically prepended.

For this situation, it looks like just changing the post type slug to 'job' and using the Types rewrite is probably the easiest answer (thanks!), but I'd love to know how to get the root/%postname% permalinks back for the custom post type in case I need to turn rewrite off? Is there some way to force Types to follow the WP permalink structure and dump the /?jobs= prefix?

Cheers

#21239

TJ

Also, just to clarify, standard posts are showing up correctly as root/%postname% - it's only the ones in the custom post type that are root/?jobs=%postname% - so it would seem the custom WP permalink structure is not completely controlling the custom post type. Interestingly though, if I set the WP permalink structure to /aaa/%postname%, the standard posts follow that structure, and the 'jobs' posts follow /aaa/?jobs=%postname%. So the WP permalink structure <b>is</b> affecting <b>all</b> permalinks, but is unable to chop off the ?jobs= part. I'm confused! Thanks again for your assistance!

#21315

TJ, I had a similar problem, and found the solution <a href="https://toolset.com/forums/topic/how-to-remove-post-type-slug-from-permalinks/">here</a>. Basically, what we want requires an extra plugin (<a href="https://toolset.com/forums/topic/how-to-remove-post-type-slug-from-permalinks/">Remove slug from custom post type</a>). I noted in the other support post that this requirement should be addressed by the plugin folks in their help text and/or documentation.

#21316

Hmm, another strange thing: even though this page claims I can use the <a> tag, my code shows through after I press Submit.

#21415

TJ

Thanks Michelle, I'll have to give this a try.

What makes me confused though is that when I first set up the new custom post type, all posts in the new type complied with the existing root/%postname% permalink structure. It wasn't until I changed the post type structure within Types a few times that the /?jobs= part was permanently prepended to the %postname% slug. Surely if the desired result was there in the beginning, there should be a way to get it back without the need for any other plugins?

I'm just cautious about using more than one plugin to control permalink structure, as if they cease support or eventually introduce conflicting bugs with other plugins, this can have a dire effect on the site. With a lot of 'timeless' articles, we can't afford to have old links die, and I'd really prefer not to have an htaccess file filled with redirects!

Is there really no way to achieve the ?jobs= removal within Types?

Again, thank you both for your help.

#21662

Dear TJ,

With permalinks set to custom and rewrite enabled for the custom post type, it should work as you expect. /job/slug-of-the-job. The plugin mentioned is to remove the /jobs/ part.
Please review the settings of the Jobs type, specially the rewrite section. Leave default settings and see if it works. To flush rewrite rules, go into Settings -> Permalinks and click Save without changing anything.

Regards,
Caridad

Le sujet ‘[Fermé] Permalink structure for custom post types’ est fermé à de nouvelles réponses.