I have two CPT:

  1. Teacher
  2. Student

As we know, one teacher can have more students. It is possible to assign the teacher to each student while creating CPT with the next steps:

  1. Create a Student
  2. Select Teacher inside Student post type
  3. Save the Teacher For example, it can be done with ACF: Choose with ACF

The question is: Is it possible to create Student posts directly inside Teacher post? It will be much easier for admin to create all this stuff in this way. I need a field that will allow to create Students and assign them to Teacher inside Teacher post type. Below is a screenshot of mockup what I need to achieve: enter image description here

The Student and Teacher will have different HTML templates so there is a need for them be different post types. I have not found any information about my issue and suspect that this is impossible to do in WordPress. Any help is appreciated :) Thanks in advance.

  • This is very possible and I’ve done things like this. You’re not actually making a post type inside another post type, what you’re really doing is associating a new ‘post_type_b’ with ‘post_type_a’. Question, are you letting teachers use the WP edit screen to do this or are they going to use a front end form/page/template? Commented Jan 16, 2021 at 16:00
  • There’s even lots of ways you can approach this, you can assign student IDs to an array in a teachers meta_data. You can auto generate a custom taxonomy when teachers are created and then assign that term to each student as they get created, this would all students to have multiple teachers, etc. Commented Jan 16, 2021 at 16:06
  • @TonyDjukic I was talking about creating Students while saving Teacher post type. It is pretty easy to bind these two post types if saving them separately. Commented Jan 17, 2021 at 16:59
  • I understood that and it is possible. I would recommend doing it with AJAX. You understand though why your question is difficult to accurately answer though, right? It’s very vague and open ended; “Is it possible?” Yes. In a number of different ways. Commented Jan 17, 2021 at 19:04

1 Answer 1


As I understood you want to be able to add Students from the Teachers post type and assign them directly to the current teacher.

Is it impossible? I don't think so but definitely not an easy task to pull off. You are going to have to manually write all the code the outputs a form inside the Teachers post type and create a Student according to the data filled once the post is published/Updated or by ajax as a separate form inside the page. (And I am not sure how viable this is).

Unless each student have only one Teacher (and I doubt this is the case) you can use a repeater inside the Teachers CPT instead of another CPT for the Students.

I would suggest you stick to it as it is and just add each Teacher and Student from there own panel while having AFC field link them together as the amount of work needed to achieve this is not worth it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.