What is your best practice to execute one-time scripts?

Question

The Problem

We all have been in a situation like this, and a lot of questions on this site need a solution like this. You either have to update a database, insert a lot of data automatically, convert meta_keys, or something similar.

Of course, in a running system based on best practises this should not happen.

But as it does, I would love to hear your personal solution to this problem, and why you chose yours.

The Question

How do you implement one-time scripts in your (running) WordPress install?

The issue here is mainly because of the following reasons:

  • Scripts that insert data should not run more than one time
  • Scripts that require a lot of ressources should not run at a time when they can not be monitored
  • They should not be run by accident

The Reason I ask

I have got my own practise, I am going to post it in the answers. As I do not know if it is the best solution out there, I’d like to know about yours. Also, this is a question that is asked a lot of times in context of other questions, and it would be great to have a ressource collecting the ideas.

looking forward to learning from you 🙂

0
, , fischi 4 months 0 Answers 61 views 0

Leave an answer