in

WordPress 2 different post types for parent and child posts


I am creating a wordpress plugin in which users can add a company.
This is a custom post type called company. Together with the company post (parent), a child post is created, called: Share
The Share child post is basically a post which uses information of the parent page.
The thing that i find very important is to achieve a very friendly url:

  1. my.com/company/coca-cola/share
  2. my.com/company/pepsi/share
  3. my.com/company/sprite/share
  4. etc.

So far, this structure works fine, but there is a problem that i would like to solve.
The “Share” child posts (logically) appear in the admin backend of the website, which makes it very messy (since there are thousands of companies listed).

I am looking for a way to achive that clean url, but to clean up the admin backend.

The solution i am thinking of, involves a different post type for the company (coca-cola, pepsi & sprite) and share. Because then i am able to define that these posts will not be shown in te admin. However, this doesnt seem to be a possibility, it is nog possible to create a hierarchy using 2 post types.

I am open for all options here,
What other options do i have to achieve the desired parent/child result?



Source: https://stackoverflow.com/questions/70551985/wordpress-2-different-post-types-for-parent-and-child-posts

A mini app demo that gets data from JSONPlaceholder

Dynamic object-oriented programming support for the Go language