Integrating Existing External Database with Custom Post Types (4 posts)

  1. Driftless
    Posted 4 years ago #

    Scenario:I have a (large) table of information -- lets even call it a "custom post type" with titles, post body, and lots of custom meta -- that I want to integrate into WordPress (or *gasp* some other CMS) to allow for all the fun tagging, categorizing, commenting, perhaps forum-izing and serving of information.

    The trick is, I also have some custom php programs that interact with the database as is. Also, I need to be able to access the database via external programs. (And, from an aesthetics/zen viewpoint I want my data all in one row.)

    Possible routes:
    1) "Simplest" Dump the database to a csv, and import it into a custom type using word-presses custom post meta functions and re-write my custom functions to pull from the WPDB structure. Let WP be king.

    THIS IS NOT GOOD. A) clumping all the meta into key,value wp_postmeta table structure will make indexing inefficient and slow down retrieval of information. B) as I said above, I need to be able to access the database via other programs - so would like to leave it as-is.

    2) Keep two databases in sync: a) Create a full custom meta system that mirrors my custom table. b) Have my custom table update the wordpress wp_posts and wp_post_metadata table (via trigger) and vice-versa (via hooks) whenever a record is added or updated. Thus wordpress can do its thing, and my programs can do their thing, but the info is the same.

    DOWNSIDE: Having two copies of the same data - even carefully synced - is asking for trouble. Especially in the unlikely case of data being edited in two place at once...

    3) Totally hack WP-Core to modify all the custom metadata functions to redirect to my custom table... which would, of course, result in infinite update headaches... If this is what is required - I would probably be better off learning Drupal and using that:

    4) Use another CMS...

    As you see, I'm brainstorming possible solutions... Any thoughts?

  2. Driftless
    Posted 4 years ago #

    Another possible route... use a middle-man csv file, google spreadsheet, or file hosted on dropbox as a proxy and keep it updated from both sources... though this seems like it might just add a complicating factor.

  3. Driftless
    Posted 4 years ago #

    Or... possibly:

    How about custom hooks that append the information from my custom-meta table to the worpdress post like hook in to wp_get_posts() ... of course the updating would have to all be done externally -- or with a custom editing feature...

    Again - I know this is all theoretical - but if anyone is interested in this concept, I would love some ideas.

  4. Driftless
    Posted 4 years ago #

    Pods might do something similar - but seems like overkill...

    Love having conversations with myself...

Topic Closed

This topic has been closed to new replies.

About this Topic