Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Custom MySQL import script to WP custom post type / custom fields WordPress


I have a project, I need to judge the severity of the task and possibly find a quote / source.


I need to import MLS MySQL data from 1 pre-defined Real Estate board, convert the data into a custom post type, convert all fields into Wordpress custom fields, run script daily via cron.


We are already importing MySQL data + downloading Images from the MLS / MySQL source into their own DB, there data is then being displayed live via PHP.


How difficult would it be; to take a simple database, convert the tables dynamically into an individual Wordpress custom post type?

Answers (2)


Lew Ayotte answers:

I recently did a script that does something similar (just a one time import) from an old database to track projects in import the data into 4 different custom post types and all the post types needed to be tied in with each other (depending on the data for each post). It was somewhat complex, took me about ~10 hours to complete... which for them translated into 1000$.

West Coast Design Co. comments:

Thanks for the reply Lew,

The database seems simple, in the fact there is 1 main table (Properties) and then a bunch of columns like: ID, Price, Agent Name, Street Name and most importantly “<strong>Type</strong>”.

I would then need to sort the data based on column ‘<strong>type’</strong> into commercial & residential, then use those as my two taxonomy categories.

Use one of the columns for the post title, rest of the columns would be custom field data … and also detect changes from the source accordingly etc.

Once I have the custom post types, I am gravy… I have lots of experience with utilizing the data.

This project will go through, I am intrigued on how it come together and how much it will cost :)


Tom Ransom answers:

We are doing something similar for Is the data coming from an MLS? If so, does it have a standard RETS interface?

You aren't going to want to replace the custom posts with each import, you are going either update (properties that were there yesterday with possible changes in price, status, description, etc.) or create the new post.

I have a number of import scripts ready to go with custom post types and taxonomies (which is more appropriate for some fields) Also have done query support for value ranges in custom fields/taxonomies.

West Coast Design Co. comments:

Yes Tom,

The data is coming from a local MLS board’s server, importing via a simple PHP script (Maybe, the local MLS board produced the script…) I know the previous web firm didn’t have any experience with MLS integration.

Not quite sure what RETS is… This has been a concern of mine with previous research and the fact that local MLS factions are reluctant to educate companies like myself, also I was lead to believe any further information / access would require an MLS Web Developer license?

That said, I did notice indication of the term ‘RETS’ in the form of a rets_debut.txt version: 1.5 in the scripts root.

I assumed the import connection was MYSQL based verses XML?

What I am seeing now, is the imported data in MySQL, and the simplicity (I am a designer) of how its laid out… Just a bunch of columns.

Tom, you are correct about the update… I just wanted to stress the importance of that functionality. At the moment, the current site has zero filter, search functionality, just a simple PHP script.

It would be too early to determine site logistics, however I have found that custom fields can act much like taxonomies, whereby you can both sort in admin and front-end….

Hence my idea of keeping this as simple as possible and importing all of the columns into custom fields.

I am sorry, if I don’t make much sense!

West Coast Design Co. comments:

PS there’s a file “<em>phrets.php</em>”

<strong>That indicates;</strong>

PHRETS - PHP library for RETS
version 0.6.2 (beta)
[[LINK href=""]][[/LINK]]