Select post parent from another post type in WordPress

Added 2016/02/05: There's a newer version of this post with very detailed steps to show you how to set the URL structure for this use case right.

This gist is kinda of my inspiration to create Completely Delete. Last year a client project need to cross reference 2 different post types. When I do some research on Google, a post from My Musings describe how to change the parent select options to posts from another post type. This is quite useful and a time saver for me.

After the cross reference work had been done, the client found another issue that when he trash or delete the parent post, the child posts won’t be trashed / deleted with it.

Few months later when I planed to develop my first plugin for the new business – 1Fix.io, I decided to fix this issue as a start point.

3 responses

  1. Hi,

    I have managed to add the meta box to link across 2 different custom post types. Unfortunately though the child post single now only shows the 404 page or with some tweaks to the register of the custom post type it shows the default posts type.

    Can you suggest anything?

    Regards,

    M

    1. Yoren Chang Avatar
      Yoren Chang

      Hey Mike, the 404 issue doesn’t look like caused by the meta box you’ve added. I’d love to check your code to see what I can help. Shoot me an email to yoren [at] 1fix.io.

  2. […] custom post types in WordPress. I’ve actually written about it two years ago, which is to select post parent from another post type. But today you’ll learn more deeply on the same topic with a live […]

Leave a Reply

Your email address will not be published. Required fields are marked *