How to create meta fields with more than 1 relation?

enter image description here

I am creating a recruitment plugin. There’s a custom post type called opening, and it has a metabox which displays a select field with a list of candidates(each option’s value is the candidate’s ID as a WP User).

Now, when the post is saved, the selected option of the field is added as a meta field of the post. The issue is that I need to know the ID of the candidate and the ID of the recruiter who assigned the candidate to the opening.

I tried adding the meta field as opening-candidate-{$candidateID}-recruiter, and assign the recruiterID as the row value, however, It doesn’t feel right to insert dynamic named columns in the DB.

Example:

I’d appreciate any better ideas to handle this!

Read more here:: How to create meta fields with more than 1 relation?

Leave a Reply

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