Custom Permalinks For CPT and pages with parent. Advanced WordPress

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?

$299 Affordable Web Design WordPress

This article was republished from its original source.
Call Us: 1(800)730-2416

Pixeldust is a 20-year-old web development agency specializing in Drupal and WordPress and working with clients all over the country. With our best in class capabilities, we work with small businesses and fortune 500 companies alike. Give us a call at 1(800)730-2416 and let’s talk about your project.

FREE Drupal SEO Audit

Test your site below to see which issues need to be fixed. We will fix them and optimize your Drupal site 100% for Google and Bing. (Allow 30-60 seconds to gather data.)

Powered by

Custom Permalinks For CPT and pages with parent. Advanced WordPress

On-Site Drupal SEO Master Setup

We make sure your site is 100% optimized (and stays that way) for the best SEO results.

With Pixeldust On-site (or On-page) SEO we make changes to your site’s structure and performance to make it easier for search engines to see and understand your site’s content. Search engines use algorithms to rank sites by degrees of relevance. Our on-site optimization ensures your site is configured to provide information in a way that meets Google and Bing standards for optimal indexing.

This service includes:

  • Pathauto install and configuration for SEO-friendly URLs.
  • Meta Tags install and configuration with dynamic tokens for meta titles and descriptions for all content types.
  • Install and fix all issues on the SEO checklist module.
  • Install and configure XML sitemap module and submit sitemaps.
  • Install and configure Google Analytics Module.
  • Install and configure Yoast.
  • Install and configure the Advanced Aggregation module to improve performance by minifying and merging CSS and JS.
  • Install and configure Schema.org Metatag.
  • Configure robots.txt.
  • Google Search Console setup snd configuration.
  • Find & Fix H1 tags.
  • Find and fix duplicate/missing meta descriptions.
  • Find and fix duplicate title tags.
  • Improve title, meta tags, and site descriptions.
  • Optimize images for better search engine optimization. Automate where possible.
  • Find and fix the missing alt and title tag for all images. Automate where possible.
  • The project takes 1 week to complete.