Created
July 13, 2025 11:11
-
-
Save AWqxKAWERbXo/37adde3d0f2b3a6d3220623d9e3c2817 to your computer and use it in GitHub Desktop.
WordPress Auto-Updates nur in Wartungsfenstern von 4 bis 6 Uhr montags bis samstags
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Plugin Name: Timed Auto Updates | |
| * Description: Erlaubt automatische Updates nur zwischen 4 und 6 Uhr, Montag bis Samstag. | |
| */ | |
| # Lege diese Datei als /wp-content/mu-plugins/timed-auto-updates.php ab | |
| add_filter('automatic_updater_disabled', function () { | |
| $current_hour = (int) current_time('H'); | |
| $current_day = (int) current_time('w'); // 0 = Sonntag, 6 = Samstag | |
| // Erlaube Updates nur Montag (1) bis Samstag (6) zwischen 4 und 6 Uhr | |
| if ($current_day >= 1 && $current_day <= 6 && $current_hour >= 4 && $current_hour < 6) { | |
| return false; // Updates erlaubt | |
| } | |
| return true; // Updates deaktiviert | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment