Import external data to WordPress post

October 14, 2011 by fMajakovskij

I’ve recently needed to add a lot of static contents into a wordpress installation.
So I had to dive a bit into the API of the most famous blogging-platform out there.

Here a bit of what I’ve learned from that task.
The first thing I did has been obviously searching some resource on google.

The starting point has been this from stackexchange.

So I figured out the right direction on the official reference.

Then this has been really helpful thanks to the very first line of code in the example:

require( '../my_wordpress_install_root/wp-load.php' );

Yes, from that hint I was able to edit wp database out of the wordpress box.

From here the docs to accomplish the category functions import:

include( "../my_wordpress_install_root/wp-admin/includes/taxonomy.php" );

remember to include the above import.

Here the tag issue:

Here the meta data API reference:

From a very recent article from SmashingMag, we can make a lot of operations direct to the MySql database:

In particular the follow can be really helpful:

UPDATE wp_posts SET post_content = REPLACE (post_content, 'a', 'b');

I will post a working example soon…

Tags: ,

One thought on “Import external data to WordPress post

  1. Josean says:

    Hi,

    do you have an example? I need it pleaseeeee

    I created a page with a form, where the people can put some data, description, location, type, etc… The visitor can send it to my database, and it is automatically included.

    But I have a problem. I would like to publish in to my blog those items wich have been introduced in my ddbb. It seems that you know how to do this. Can you tell me how, please?

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>