Hello guys, I hope you are doing well.
I have a site that has two post types for "online course" and "in-person course" I want them both to use the permalink structure as:
hidden link
For instance, I want to change:
From: hidden link
To: hidden link
or
From: hidden link
To: hidden link
or
From: hidden link
To: hidden link
Notes:
+ "oferta-academica" is currently a normal page (hidden link)
+ after %post_type_slug% I want the structure to be the same as now. So basically, I want to add the "oferta-academica" segment before the current structure and change nothing else.
+ the "online course" post type is a LearnDash post type, while the "in-person course" is a toolset custom post type.
Please note I have researched and found a couple of posts suggesting an "add_permastruct" snippet (https://wordpress.stackexchange.com/questions/216337/change-permalink-structure-for-custom-post-type), but I'm unable to understand how to accomplish my need.
Finally, I would like this structure to be reflected in the breadcrumb. Thanks as always for your great support.
Hello and thank you for contacting the Toolset support.
The suggested solutions on that StackExchange thread is based on custom code that should be added to a theme's file, a plugin, or using a 3rd party plugin such as Code Snippets. https://wordpress.org/plugins/code-snippets/
Toolset also offers a way to add custom code to your website. Check this article https://toolset.com/documentation/adding-custom-code/
However, you won't need to use any custom code for this target permalink structure, especially, because you are using Toolset :-).
Just update the custom post type definition to add a rewrite rule. Check this screenshot hidden link
Then, you will need to save the permalink structure twice to purge WordPress rewrite rules. Go to Settings->Permalinks and just save the page twice.
Check an example post's URL here hidden link
You can login to my test site using this one-click-login link hidden link
As you can see, I also created a page with the slug /offers/
Regarding the breadcrumbs, I can't really tell. The breadcrumbs are not a default WordPress or Toolset feature. It is usually a theme's or plugin's feature. Depending on what provides it on your website, the solution may be different.
I hope this helps. Let me know if you have any questions.
Jamal, thank you for the reply. It provided a better understanding of how to accomplish my goal.
However, something is not quite working well.
I managed to change the permalink structure for the "curso-presencial" as you pointed out. The actual post types' posts are working, but the "archive" page is not working. I noted it is not working in your demo eighter.
My new working link:
hidden link
New Archive page not working (404):
hidden link
IMPORTANT: the previous archive worked just fine: hidden link
Any idea?
Regarding the breadcrumbs, it is not working, but I will ask the YOAST support team, as they are the best to answer.
FYI, I also did a similar change on the taxonomies I created, and it is working perfectly.
Thank you for your feedback.
Regarding the 404 error on the post type archive page, it turned out to be caused by the first "/" in the rewrite slug. I used "offers/course" instead of "/offers/course" and then saved the permalinks twice, and it worked on my test site. Check this screenshot hidden link
The post type archive is now working correctly hidden link
Regarding the breadcrumbs, I totally agree, the Yoast team is the best one to answer your question. If it will our help too, let me know.
It worked like a charm. Thanks for the help. My issue is resolved now. Thank you!