Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I need to use an existing database table as a Custom Post Type (CPT) to integrate it with wordpress.

I've considered @boone-gorges thoughts here (should I?) and have decided, Yes, I need to use a custom table (mostly for indexing of the 20+ "custom meta" fields that would get bogged in wordpress' native handling of custom meta.)

Aside from home-grown display and usage of data, I need tight integration with Wordpress (acts and behaves like CPT) so that I can:

Editing / Updating through WP would be a bonus - though not necessary (the table will be edited mostly via external programs, which is another reason it needs to be separate).

Is there a slick way to make this happen? Perhaps implementing hooks that hijacks calls to that CPT and directs them to the other table?

I'm looking at Pods - but this seems like overkill.

share|improve this question
    
When you take a Corolla and you it to run like a Jaguar someone will pull their hair at some point. Wordpress is designed to work in a certain way and I suggest for the sake of future updates that you tweak your algorith a little. For instance the reason the CPT functionality came along was so that we don't use other tables unnecessarily. I think you should think along those lines –  Janvier Jul 31 at 5:17

1 Answer 1

My educated guess you will drown in edge cases, exploding in your face, if you try to shard specific post type in separate table.

Since you seem to be actually concerned with meta rather than posts themselves, you could:

  • implement custom table for it
  • use Metadata API to store it in separate table, while retaining some degree of API compatibility.
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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