1

I don't want to update plugins within business hours. Is there a way to schedule for after 1 am? Maybe via a hook or a setting in wp-config.php?

1 Answer 1

2

You could create a cronjob that runs on 1am every 24 hours. With WP CLI this would be something like:

wp core update && wp plugin update --all && wp theme update

So you just create a .sh script, put the above in it, and run the script with a cronjob.

4
  • Ok, good idea. So I would deactivate automatic updates in WordPress itself and do it with wp cli, right?
    – Marc
    Oct 16, 2020 at 9:56
  • I tried this. My problem is that I can only add conjobs for urls and not for shell scripts. So I tried to do this via exec_shell but that is prevented either. WP CLI is good but maby not for everyone. Another idea how to schedule the build in updates somehow?
    – Marc
    Oct 17, 2020 at 6:42
  • Hi Marc, take a look at this solution, as it seems to be right what you are looking for: wordpress.stackexchange.com/questions/329683/… Oct 22, 2020 at 17:01
  • I accept this as the best answer. In the end used another server to ssh into the wp server and execute this command: wp core update && wp plugin update --all && wp theme update but I had to add the --path=/www/htdocs/myfolder to it. Thank you!
    – Marc
    Oct 25, 2020 at 10:41

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.