Use Custom Database with Custom Post Type

I decided to ask this question as searching online left me really overwhelmed and not knowing which direction to take.

I am about to tackle a project that has its own custom database (finished e-r design) in MySQL, and I want to use WordPress as its CMS.

Read More
  1. Can I make custom post types but pull/save records from/to the custom database? if so, any link to resources would be much appreciated, like:

    • Should I merge the databases or can I keep working them independently?
    • For the custom post type’s admin area, how do I use this to pull/save entries from/to the custom database’s table(s) for individual records?
    • Do I use/make custom fields in the custom post types and then rely on some hook to pull/save them from/to the custom database?
    • Will I be able to delete the posts in WordPress and also delete the corresponding entry in the custom database?
  2. Is there a wiser way to go about this whole thing? I’m very open to suggestions/informed guidance.

I found the following resources, but I just can’t pull them all together:

  1. https://stackoverflow.com/questions/7538337/save-the-data-of-custom-metabox-to-database – but how do I do this for a custom database?
  2. http://www.deluxeblogtips.com/meta-box – is this something I should look at or is it overkill?
  3. http://Wordpress.org/support/topic/migrate-from-custom-database-to-Wordpress-database – this kind of hits the spot but not quite; if I want to work on the custom database without merging it with WordPress what do I do?

Again, I’m just fumbling my way around these options as these are what I’ve come across so far. If someone knows a better/more correct way to tackle the whole problem and not just piecing-together disparate info ending up with a frankensteined setup then I would love to hear what you have in mind.

Related posts

Leave a Reply

1 comment

  1. What I understand is you want to update records/table to another database from wordpress…. well you can achieve this in wordpress 3.1> using

    $newwpdb = new wpdb("mysqluser","mysqlpassword","mysqldbname","mysqlhost");
    

    Then using $newwpdb you can access table from new database and perform all operation on it like edit/delete update/insert… same as $wpdb do wordpress….

    Hope that helps or you may post your code for more understanding….