WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We have received a URL which is a JSON file apparently:


I am completely clueless when it comes to JSON and Wordpress.

Anybody know where to start?

We will need to create individual posts from this JSON file I presume..

share|improve this question
There are some PHP native function like json_encode() and json_decode() – JMau Jun 7 '13 at 18:31
up vote 4 down vote accepted
  1. json_decode the JSON into an array.

    $slices = json_decode(file_get_contents('yourJSONFile.json'),true);
  2. Loop into the data

    if ($slices) { 
       foreach ($slices as $slice) {
          $title = $slice[1];
          // insert more logic here
  3. Create a post programmatically by using wp_insert_post.

    // Create post object
    $my_post = array(
         'post_title'    =>  $title,
         'post_content'  => 'This is my content',
         'post_status'   => 'publish',
         'post_author'   => 1,
         'post_category' => array(8,39)
    // Insert the post into the database and return the new post ID
    $post_id = wp_insert_post( $my_post, $wp_error );

More details in this tutorial: http://tommcfarlin.com/programmatically-create-a-post-in-wordpress/

share|improve this answer
Please try to include at least summary of information from URL into answer. Links tend to rot, making answers crippled. – Rarst Jun 7 '13 at 21:17
ok thanks for this - it is useful info - if you are aware of any relevant wordpress plugins that would be great too.. – Mario Lorenzo Jun 8 '13 at 12:33

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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