-
json_decode the JSON into an array.
$slices = json_decode(file_get_contents('yourJSONFile.json'),true);
-
Loop into the data
if ($slices) { foreach ($slices as $slice) { $title = $slice[1]; // insert more logic here } }
-
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, true ); if ( is_wp_error( $post_id ) ) { // error handling.... }
More details in this tutorial: http://tommcfarlin.com/programmatically-create-a-post-in-wordpress/
Related Posts:
- Can comments be used in JSON?
- Can comments be used in JSON?
- Angular: ‘Cannot find a differ supporting object ‘[object Object]’ of type ‘object’. NgFor only supports binding to Iterables such as Arrays’
- Grabbing the current viewer count for youtube live streaming
- Use of PUT vs PATCH methods in REST API real life scenarios
- What is the easiest way to convert an Excel spreadsheet with tabular data to JSON? [closed]
- Can comments be used in JSON?
- Select objects based on value of variable in object using jq
- What is the difference between YAML and JSON?
- How to install JQ on Mac on the command line?
- Fastest JSON reader/writer for C++
- Representing null in JSON
- YAML equivalent of array of objects in JSON
- Are multi-line strings allowed in JSON?
- Remove properties from objects (JavaScript)
- Python/Json:Expecting property name enclosed in double quotes
- How to remove the quotes when reading a variable in jq in shell?
- Why do i need `typings.json` file in an Angular 2 project?
- Best way to save data in Unity game
- Javascript Object push() function
- How do you represent a JSON array of strings?
- Using Wikipedia API on custom wikis like Bulbapedia
- How to import a JSON file in ECMAScript 6?
- UnicodeDecodeError: ‘utf8’ codec can’t decode byte 0x80 in position 3131: invalid start byte
- How to parse Excel (XLS) file in Javascript/HTML5
- XSLT equivalent for JSON
- RestClientException: Could not extract response. no suitable HttpMessageConverter found
- Is there a query language for JSON?
- Why do i need `typings.json` file in an Angular 2 project?
- How do I make a JSON object with multiple arrays?
- An error occurred while installing json (1.8.1), and Bundler cannot continue – Rails
- How to sort a json file by keys and values of those keys in jq
- JSON and escaping characters
- Sending JSON string through wp_remote_post()
- What are the Oembed Links For?
- Get Image URL instead of Attachment Id in Rest API
- WP API returning SQL results as strings, rather than numbers
- What is /wp-json?
- Include custom post meta value in fetched JSON
- Unset data in custom post type WordPress API (wp-json)
- How to retrieve wp_ json_encode data from custom WordPress database table
- How to use the new WordPress 4.4 JSON API?
- Importing JSON feed should the content be sanitized?
- WP REST API – Retrieve content from page
- Create filtered list of posts using JSON data
- wordpress API for android app
- Android authentication
- WordPress JSON API returns normal site page in html. How do I get it to give me JSON?
- Create multiple posts with WP REST API at once
- Passing Meta array in wp-rest api
- Have WordPress generate a JSON of the content
- Inserting custom post meta value using WP-REST API
- Adding JSON Structured Data to WordPress
- WP REST API format response
- esc_attr() corrupts json values
- Pre insert data when adding new custom post fire a json error
- Generate/save JSON or XML file from JSON script
- Cannot parse results from wp_remote_get
- WordPress Unexpected token < in JSON at position 0
- Update the values of a json file in wordpress [closed]
- How to send s2member plugin’s wordpress user data in json format to a url in php [closed]
- Create and Update a Json file
- How to display json_encode via $wpdb
- Why is json_decode failing?
- How to get a custom entry field label with Gravity Forms?
- WP REST API. Configuring JSON routes
- JSON API not showing full content
- JSON-LD: creating an AggregateOffer from many shortcode
- Strange “lea” prefix on wp-json
- How to display partial values of JSON Encode values
- Retrieving a JSON feed of my posts and displaying thumbnails
- WordPress restrict access to rest only
- Import JSON feed into WordPress Post (wp_insert_post) every 24 hours
- Sending a post request with JSON content type
- A special character I am trying to include in a page keeps getting rejected with error “Updating failed. The response is not a valid JSON response.”
- wp-json how to fetch image link?
- Received Updateing failed. not a valid JSON response. linked with _locale=user
- Automatically import content to wordpress from a json file
- JSON api oembed youtube
- Wrong encoding of dynamic block properties problem
- i am using api add post in wordpress
- Add binary or json animation to wordpress site
- Run hook in functions.php from page link
- JSON Schema Output Object rather than Array
- Add custom schema to post
- How can cookie/session authentication be used in wp-json fetch request?
- Get the name of the post type
- I can’t get those posts from the wordpress to ionic
- Dynamic data table from external json feed
- return content section as json in wp rest api v1
- Remove a field from json in wp rest api v1
- Control character encode after using jquery autocomplete
- Output JSON and no theme
- Get JSON from self hosted wordpress site
- how build custom json api controller for all registered users
- WP REST API get all posts (or customs posts) for a React app
- How do i save this python code to text file.? [closed]
- Custom Backend data for map to JSON file?
- Fatal error in custom end point in WP-JSON
- Error /wp-json/wp/v2/posts/ [closed]