So, I’ve created a CPT – Community Post: https://pastebin.com/9XSrvZAr
For this CPT I’ve created two custom taxonomies: https://pastebin.com/fNhfpiM6
community_post_domain
community_post_type
My goal is that the permalink of all single community posts will go as follows:
https://example.com/community/%POST_DOMAIN_SLUG%/%POST_SLUG%
So, for example, if I have a community post with the title ‘Go Micro Services’, and it has community_post_domain set to a term named Kubernetes, the permalink will be:
https://example.com/community/kubernetes/go-micro-services.
This is how I do the permalink manipulation: https://pastebin.com/aP5rEBjY
Also, I’ve created a static page: Community, that has the permalink: https://example.com/community.
So far, so good. The problem arises when I try to publish a page and I want it to have a permalink like so: https://example.com/community/%PAGE_SLUG%
I create the page, let’s say, for example, Hello World. I set the parent to be the Community page. When I click Publish, the page is created, and in the WordPress dashboard I see that the page’s permalink is as expected: https://example.com/community/hello-world
BUT, and this is the actual problem – when I’m trying to visit the page’s permalink, I get 404.
I tried going to Permalinks in WP dashboard and update the permalinks, didn’t help. Any Ideas here?