I don't know where to start with this one.

I would like to create custom post type which will list properties on clients website. I would like those properties being feed from another website/software. So other website/software will be sending XML file to my Wordpress site and I would like to receive that file and convert it to my custom posts.

Could anyone help me to get my head around this task, i.e. where to start? Do I need to create custom table in my database? How do I capture that XML file? Any info would be much appreciated.


2 Answers 2


Fetching the data

To fetch your posts, you'd utilize the HTTP_API, fetch_feed() or SimplePie. This completely depends on how and from where you're going to get the XML.

Here's one answer about the HTTP API](https://wordpress.stackexchange.com/a/73659/385) and another one.

Storing & maintaining the data

The main problem will be that you need a storage location. Therefore you'd go and set up a Custom Post Type and maybe some Custom Taxonomies as well. Just make sure that they're properly registered to each other. The tough part will be inserting, updating and deleting the post data, meta data, authors and taxonomies terms.

Retrieving the data on interval

Normally you'd utilize the Transient API and/or the Schedule/Cron API.


I made such a script for our own company.

My case:

I needed a script that imported a list of XML files and made a post for every row in the file.

What I did:

  • I made a CPT in wich I stored feed information
  • In a script I created a XML import wich makes a post for every row
  • The script was put in a cronjob that runs once a day to refresh the data

My code:

Here's my code: http://pastebin.com/NAhspY20 (will expire in 30 days)

It wont be entirely what you are searching for, but I hope it will give you an idea of where to start.

  • 1
    Can you post your code in your answer? Answers last a lot longer than pastebins 30 days. You may also want to try a more persistent service, I use gist.github.com but you might now others
    – Tom J Nowell
    Apr 7, 2014 at 22:54
  • 1
    Sadly this answer has a dead link. Do you still have code to add to here or shall we delete the answer?
    – kaiser
    Oct 5, 2015 at 0:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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