posts – How to automate creating pages on a hosted wordpress from a local set of folders?


I have a set of folders on my computer (mac) with a txt file and several photos, and I want to make a page out of each folder’s content on my hosted wordpress.

I think I understand how this is supposed to work but I would like to know if I am on the right path, or if I am misunderstanding something. As I understand it, I should…

  1. Upload all of the folders by FTP to the hosted storage,
  2. write a PHP script that uses wp_insert_post() and loops through the folder contents to populate the post parameters (title, text, photos, categories, etc.),
  3. run the script through WP-CLI (if it is available on my hosting)

I would then expect (if I did everything right) that I would see several posts in the Posts section of my dashboard containing the content I specified…

Am I on the right path? Is there a way to do this without wp-cli? Thank you!

changesquare 4 months 2021-06-19T09:31:35-05:00 0 Answers 0 views 0

Leave an answer