I have a couple of custom post types (course and assignment) for an custom LMS plugin that I'm building. The course CPT represents content that is produced internally by the company. The assignment CPT represents content produced by students. Both have the potential for representing a lot of data. Because the assignment CPT is being externally produced by students, I felt that it would be better practice to have it stored in a separate database table.

Is this possible to do and still have access to all the WP_Post class functionality that would come with using a CPT. Now, I've learned that WordPress MultiSite will create a full set of tables for a second or third blog, what I'm looking for is perhaps an in between hack so that I can just create a separate set of Post tables (ex. wp_2_post & wp_2_postmeta) and still access it from the first blog with all the Post class functionality. Like calling the WP_Post class and assigning it to look at a different table for its data.

Can it be done? And if it can be done, any thoughts on if this would be advisable or if there was a better solution. Thank you!

  • 1
    I'm not seeing a real reason for using a separate table, even given the fact the assignment CPT is being externally produced. Can you clarify/expand on your concerns about using the default posts table? – TheDeadMedic May 24 '17 at 17:16
  • Well, that was part of my throwing the question out there was to field whether or not that was valid concern. Would there not be any database efficiencies or other benefits from doing so? I'm guessing probably not, judging by your response. – Brent May 24 '17 at 18:26
  • 1
    I don't think you'll have any issues unless you're planning to store millions of entries, and even then it's more down to your mysql setup. What I'm saying is save yourself the headaches of splitting tables, you're pre-optimising ;) – TheDeadMedic May 24 '17 at 18:57
  • Fair enough. Thanks for sharing your thoughts and insight. – Brent May 26 '17 at 5:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.