WP-CLI-Befehle für WP Staging

The WP STAGING plugin is a powerful tool for creating a staging environment for your WordPress website or high-performance backups. It allows you to make changes, test new features, and perform updates without affecting your live site. This document provides instructions on how to use WP CLI commands specifically designed for the WP STAGING plugin.

Voraussetzungen

Bevor du die WP-CLI-Befehle für das WP Staging Pro Plugin verwendest, stelle sicher, dass die folgenden Voraussetzungen erfüllt sind:

  1. WordPress-Installation: Stelle sicher, dass WordPress auf deinem Server installiert ist.
  2. WP-CLI: Stelle sicher, dass WP-CLI (Command Line Interface für WordPress) auf deinem Server installiert ist. Lies die WP-CLI-Installationsanleitung.

Ein reguläres Backup über WP-CLI erstellen

Der wp wpstg backup-create-Befehl ermöglicht es dir, ein Backup deiner WordPress-Umgebung zu erstellen. Dieses Backup stellt sicher, dass du zu einem vorherigen Zustand zurückkehren kannst, falls Probleme beim Testen oder Aktualisieren auftreten.

Syntax

Bash
# Regular Syntax
wp wpstg backup-create

# Run WP Cli as sudo
sudo -u myuser -- /usr/local/bin/wp --path='/home/example.com/public_html/' --url='example.com' wpstg backup-create

Es gibt mehrere Parameter, die du verwenden kannst:

name

default value: null

Beschreibung: Name der Backup-Datei. Unterstützter Eingabetyp: String

Usage:

ShellScript
wp wpstg backup-create name=my-backup 
# or
wp wpstg backup-create name='backup name with spaces'

includes

default value: database, mu-plugins, plugins, themes, uploads, others

Beschreibung: Teile, die in das Backup eingeschlossen werden sollen. Unterstützte Werte sind databasemu-pluginspluginsthemesuploads und others.
It also support multiple values. Use comma to add multiple values like database,plugins,uploads.

Verwende nur den includes– oder den excludes-Parameter. Wenn beide verwendet werden, wird der includes-Parameter bevorzugt und der excludes-Parameter ignoriert

Usage:

ShellScript
wp wpstg backup-create includes=plugins,themes
# or
wp wpstg backup-create includes=database

excludes

default value: null

Description: Parts to exclude from the backup. Supported values are databasemu-pluginspluginsthemesuploads and others. It also support multiple values. Use comma to add multiple values like database,plugins,uploads. Only one of includes or excludes parameter to be used. If both are used in command includes param will be preferred and excludes param will be ignored

Usage:

ShellScript
wp wpstg backup-create excludes=database
# or
wp wpstg backup-create excludes=plugins,mu-plugins

advanced-excludes

default value: null

Beschreibung: Zusätzliche Teile, die vom Backup ausgeschlossen werden sollen.

Unterstützte Werte: logs, caches, deactivated-plugins, unused-themes, post-revisions, spam-comments

Usage:

ShellScript
wp wpstg backup-create advanced-excludes=logs,caches,deactivated-plugin,unused-themes,post-revisions,spam-comments

storages

default value: local-storage

Beschreibung: Speicher, in denen das Backup gespeichert/hochgeladen werden soll. Einige häufig unterstützte Werte sind local-storagegoogle-driveamazon-s3dropbox und sftp.

Es werden auch mehrere Werte unterstützt. Verwende Kommas, um mehrere Werte wie google-drive,amazon-s3,sftp hinzuzufügen. Stelle sicher, dass die Speicher, die du verwenden möchtest, bereits über deinen WordPress-Adminbereich authentifiziert sind.

Usage:

ShellScript
wp wpstg backup-create storages=google-drive
# or
wp wpstg backup-create storages=local-storage,sftp

Create a scheduled backup plan via WP CLI

Du kannst geplante Backup-Zeitpläne über WP-CLI erstellen:

schedule

default value: null

Description: How often the backup should repeat. Supported values: hourlyevery-six-hoursevery-twelve-hoursdailyevery-two-daysweeklyevery-two-weeksand monthly. Only one value is supported at a time. If its value is not set, backup will not be schedule.

Usage:

ShellScript
wp wpstg backup-create schedule=hourly
# or
wp wpstg backup-create schedule=monthly

retention

default value: 2

Beschreibung: Anzahl der Backups, die für diesen Zeitplan aufbewahrt werden sollen. Unterstützte Werte: 1 bis 10. Ein gültiger schedule-Wert ungleich null ist erforderlich, andernfalls wird diese Option ignoriert.

Usage:

ShellScript
wp wpstg backup-create schedule=monthly retention=3 
# or
wp wpstg backup-create schedule=monthly retention=5

time

default value: 00:00

Description: At what time the backup should start first schedule. Supported value is time in 24-hour format i.e. 13:0005:4223:5900:00 and 10:45. You can also use now to create backup immediately using current time as first repeating time. Valid schedule value other than null is required otherwise this option will be ignored.

Usage:

ShellScript
wp wpstg backup-create schedule=daily time='00:15'
# or
wp wpstg backup-create schedule=monthly time='12:12'
# or
wp wpstg backup-create schedule=monthly time='now'

Status eines laufenden Backups mit WP-CLI anzeigen

Der wp wpstg backup-status-Befehl zeigt den Status und die Details eines laufenden Backups in deiner WordPress-Umgebung an. Er liefert Informationen wie die Backup-ID, den Titel, das Erstellungsdatum und die Beschreibung.

Syntax

Bash
wp wpstg backup-status

Fazit

The WP STAGING plugin and the provided WP CLI commands offer a convenient way to manage backups and monitor their status in your staging environment. By following the instructions outlined in this documentation, you can effectively create backups and stay informed about the available backups within your WordPress site.

Updated on März 6, 2026