Hello, so you’re the hit to my analytics today π
Sorry about the spam part, not sure why it’d think that and I will have to investigate.
Regarding the custom structure part, I don’t have an immediate answer why it needs to be the %postname% only version, but that’s what I had always seen when previously googling this topic. If I find out why, I will definitely add to the post to include explanation. That said, I don’t have an alternative version available to have it also work with %category%%postname%
Out of curiosity, what solutions is that version of the permalink rewrites solving?
π Yep, that was me.
So this particular site has been around for a while and that’s how the permalink structure was set up when I started maintaining this site and others for the org. The SEO team had requested it, I believe, so changing it at this point might cause further issues and a larger discussion since I can’t just go ahead without SEO approval which I may not get.
I’ll run it past the SEO manager and see whether it’s still a thing, we had a person managing SEO prior to this individual that made that choice.
I just want to resolve it and move on with my life. π
Hi @ladydev,
I had the same problem and used this code: https://kellenmace.com/remove-custom-post-type-slug-from-permalinks/
Important: do not use a slash for the front. Otherwise, you might break other parts of the site (in my case the WooCommerce endpoints became 404s) and might spent days with turning plugins on and off again, until you came across the cause. So @tw2113, maybe you can address this in a future apdate with at least a warning.
Best regards!
@89garvhf23 Coincidentally Kellen’s post is where I adapted mine, and he’s a friend and former coworker at WebDevStudios.
Regarding your comment about the slash for the front, are you referring to something in the code from Kellen’s and my posts? Or is this in regards to perhaps the rewrite_slug setting in CPTUI and general post type registration? Leave it default so that falls back to post slug, or set it to something, whatever is chosen?
Trying to make sure I potentially update the post accurately.
Hi @tw2113,
Thanks for your reply. Funny. I did not check your code. Just realized it did not work.
I am referring to CPTUI where I put a slash as a front in the CPT settings and probably (not sure anymore) adapted Kellen’s code to work with that. Maybe it even worked without modification.
But that led WordPress to go 404, either on the WooCommerce endpoints or the CPT I created with CPTUI, depending on the right procedure of activating/deactivating CPTUI and saving permalinks (which was the time sonsuming part to find this co-relation).
I guess, it would also be a general problem. But I did not check for that.
Thanks for the great work on this plugin!
-
This reply was modified 4 years, 1 month ago by
89garvhf23.
@89garvhf23 @ladydev either of you come to a working solution for your issues here?
Hi @tw2113,
Thanks. I solved the issue. Using the code from above and leaving out the slash as a front in the CPTUI settings works for me. Thanks for asking.