0

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!

5
  • 1
    you can host the site locally and run WP CLI on your computer then upload the result if your host doesn't allow it, but I'm unclear on what it is you're asking. Remember, you need a specific question that can be answered with a factual answer, that you can mark not just as the most useful reply but the canonicall answer for all people with this single question. Right now this looks like you're wanting reassurance, and there is no singular golden path that you can be put on that could be written up as the correct defacto answer.
    – Tom J Nowell
    Jun 19, 2021 at 14:52
  • E.g. you could use the REST API or XMLRPC to do this instead, but those methods would not be more right or wrong, so couldn't be written up as a solution to your question
    – Tom J Nowell
    Jun 19, 2021 at 14:54
  • I think what you wrote would be a an answer - "there are different ways of doing this, including what you mentioned, or... and...". Would it be more appropriate to change the title to "What are different ways to automate creating pages on..."? Or is that still too vague? Jun 19, 2021 at 15:00
  • If you're not using wordpress.com free hosting and are able to use plugins, then I would recommend using WPVividBackup plugin, it creates a zip folder of the entire website and database, so you can backup your local environment and restore it on your hosted Wordpress. And it's free! Jun 19, 2021 at 16:54
  • 2
    Doesn't necessarily need to be a custom WP-CLI command. Could also be a custom plugin. Can also be done locally, then on Live upload the upload folder and import DB. Sounds like a nice riddle to solve. Wish I had this issue at work. Anyways, make it work locally first with the right WP-CLI commands to reinstall WordPress over and over again and retry. Finally do it on Live.
    – leymannx
    Jun 21, 2021 at 20:03

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.