Title: Import Slides from JSON programatically
Last modified: August 4, 2021

---

# Import Slides from JSON programatically

 *  Resolved [corsodev](https://wordpress.org/support/users/corsodev/)
 * (@corsodev)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/import-slides-from-json-programatically/)
 * Hello,
 * I’m creating a theme and would load differents slides on the theme activation.
 * I actually have set your plugin as a “required plugin”, but i need now to load
   my defaults sliders.
 * I exported a json file with the wanted slider, from your export menu, but can’t
   find a way to import it from php.
 * I would like reproduce your “import” menu, but from the code directly.
 * Do you have any idea about the way i should proceed ?
 * Thanks a lot, and nice work.

Viewing 1 replies (of 1 total)

 *  [Kevin Batdorf](https://wordpress.org/support/users/kbat82/)
 * (@kbat82)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/import-slides-from-json-programatically/#post-14740291)
 * Hey,
 * How much coding experience do you have? The application will just send a POST
   request with the JSON file that gets sent to the server where it does some validation
   then processes it.
 * That endpoint is here: [https://plugins.trac.wordpress.org/browser/ml-slider/trunk/admin/routes/api.php#L448](https://plugins.trac.wordpress.org/browser/ml-slider/trunk/admin/routes/api.php#L448)
 * You could send a post request to the same endpoint using any method you’d like,
   but would need to be authenticated, of course. That’s beyond the scope of what
   I can help with, but you can check out how I did it with JS here:
 * [https://plugins.trac.wordpress.org/browser/ml-slider/trunk/admin/assets/js/app/api](https://plugins.trac.wordpress.org/browser/ml-slider/trunk/admin/assets/js/app/api)
 * Check the _setup.js file and the Slideshow.js file for the import method.
 * Alternatively, you could just load in the PHP class directly (check the top of
   the first file I linked to above), then invoke the import method with the JSON
   file directly. You may need to import other dependencies but I think you would
   easily identify them by whatever error message you got otherwise.
 * The import method itself isn’t necessarily impressive, so you could also write
   your own modeled after it:
 * [https://plugins.trac.wordpress.org/browser/ml-slider/trunk/admin/slideshows/Slideshows.php#L309](https://plugins.trac.wordpress.org/browser/ml-slider/trunk/admin/slideshows/Slideshows.php#L309)

Viewing 1 replies (of 1 total)

The topic ‘Import Slides from JSON programatically’ is closed to new replies.

 * ![](https://ps.w.org/ml-slider/assets/icon.svg?rev=3568997)
 * [Slider, Gallery, and Carousel by MetaSlider - Image Slider, Video Slider](https://wordpress.org/plugins/ml-slider/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ml-slider/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ml-slider/)
 * [Active Topics](https://wordpress.org/support/plugin/ml-slider/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ml-slider/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ml-slider/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Kevin Batdorf](https://wordpress.org/support/users/kbat82/)
 * Last activity: [4 years, 10 months ago](https://wordpress.org/support/topic/import-slides-from-json-programatically/#post-14740291)
 * Status: resolved