Title: SnapShots
Author: EverPress
Published: <strong>2020 年 5 月 12 日</strong>
Last modified: 2024 年 12 月 4 日

---

搜尋外掛

![](https://ps.w.org/snapshots/assets/banner-772x250.png?rev=3202237)

這個外掛**並未在最新的 3 個 WordPress 主要版本上進行測試**。開發者可能不再對這個
外掛進行維護或提供技術支援，並可能會與更新版本的 WordPress 產生使用上的相容性問題。

![](https://ps.w.org/snapshots/assets/icon-256x256.png?rev=3202237)

# SnapShots

 由 [EverPress](https://profiles.wordpress.org/everpress/) 開發

[下載](https://downloads.wordpress.org/plugin/snapshots.2.8.2.zip)

 * [詳細資料](https://tw.wordpress.org/plugins/snapshots/#description)
 * [使用者評論](https://tw.wordpress.org/plugins/snapshots/#reviews)
 *  [安裝方式](https://tw.wordpress.org/plugins/snapshots/#installation)
 * [開發資訊](https://tw.wordpress.org/plugins/snapshots/#developers)

 [技術支援](https://wordpress.org/support/plugin/snapshots/)

## 外掛說明

You are developing things on a WordPress site and would like to have a _snapshot_
of the current state of your site? **SnapShots** will help you save states of your
WordPress environment.

 * Save snapshots of your site with a simple click.
 * Name your snapshots for easy distinction.
 * SnapShots stores current location and redirects after restore.
 * Stores and restores database tables and files in upload folder.
 * Automatically logs in current user.
 * Automatically clears old snapshots with same name.
 * Small footprint and minimal UI.

### Options

All options are defined via constants and can get overwritten with a filter. The
format of options is

    ```
    SNAPSHOTS_[OPTION_NAME]
    ```

Best to define your custom option constants in the `wp-config.php` file.

You can use filters options like

    ```
    add_filter( 'snapshots_[option_name]', function( $default_option ){
     return $my_option;
    });
    ```

#### Default Options

    ```
    // Default save location.
    SNAPSHOTS_FOLDER : WP_CONTENT_DIR . '/.snapshots'

    // add '--allow-root' to each command if you run the commands as root.
    SNAPSHOTS_CLI_ALLOW_ROOT: false

    // define the location of your 'wp' binaries.
    SNAPSHOTS_CLI_PATH: '/usr/local/bin'

    // Number of shots kept with the same name.
    SNAPSHOTS_MAX_SHOTS: 2

    // SnapShot includes files from content folder.
    SNAPSHOTS_SAVE_FILES: true

    // SnapShot includes location (URL) during creation to redirect on restore.
    SNAPSHOTS_SAVE_LOCATION: true
    ```

## 安裝方式

 1. Upload `snapshosts` to the `/wp-content/plugins/` directory.
 2. Activate the plugin through the ‘Plugins’ menu in WordPress.
 3. Click on “Click here to create your first Snapshot!” in the admin bar to create
    your first Snapshot.
 4. Restore the saved snapshot by clicking on the menu entry and confirm.
 5. All tables not used in the current SnapShot with the DB prefix will be removed!

## 常見問題集

### What are the requirements for SnapShots

You need [WP CLI](https://wp-cli.org/) installed (at least version 2.2) and PHP 
must be able to execute external programs with PHPs [`exec`](https://www.php.net/manual/en/function.exec.php)

### Does it work without WP CLI?

No, WP CLI is essential here and SnapShots will not work without it. You will not
be able to activate the plugin without the addon.

### Does it work with “Local”

Yes, the plugin has been tested with the [amazing tool](https://localwp.com/) from
WPEngine and works out of the box.

### Snapshots requires the php in your PATH environment

SnapShots tries to find the `php` binary on your system. If it can’t find it, you
will get this error. You can define the location of your `php` binary by open your
terminal and running

    ```
    `
    ```

dirname $(which php)
 `

This returns the directory of your php binary. Use this location to define the constant`
SNAPSHOTS_PHP_PATH` in your `wp-config.php` file. For example:

    ```
    `
    ```

define( ‘SNAPSHOTS_PHP_PATH’, ‘/usr/local/bin’ );
 `

**Don’t include the `php` binary in the path!**

### Your Home URLs do not match

Snapshots checks if the home URL of your site matches the one from `wp option get
home`. If they are not equal it often that the `DB_HOST` variable is not defined
correctly. This also happens if you use a socket for your MySql connection (Local
WP).

Update your DB_HOST variable in your `wp-config.php` file to something like this:

    ```
    `
    ```

define( ‘DB_HOST’, ‘localhost:/tmp/ysql/mysqld.sock’ );
 `

This should not affect the regular usage of your site. If you encounter any problems,
You can wrap the statement like so:

    ```
    `
    ```

if ( defined( ‘WP_CLI’ ) && WP_CLI ) {
 define( ‘DB_HOST’, ‘localhost:/tmp/ysql/
mysqld.sock’ ); }else{ define( ‘DB_HOST’, ‘localhost’ ); } `

### Snapshots requires the “exec” method

SnapShots uses the PHP [`exec`](https://www.php.net/manual/en/function.exec.php)
method to execute the WP CLI commands.

    ```
    `
    ```

### Snapshots requires WP-CLI!

SnapShots requires the [WP-CLI](https://wp-cli.org/) to be installed on your system.
Please install it and make sure it is available in your `PATH` environment.

## 使用者評論

![](https://secure.gravatar.com/avatar/d45503ebaa33512ed7419d9e84166b33cb450af4ef20dd233ce8c964a03ba39f?
s=60&d=retro&r=g)

### 󠀁[Excellent Idea and Plugin](https://wordpress.org/support/topic/excellent-idea-and-plugin-2/)󠁿

 [greencj](https://profiles.wordpress.org/greencj/) 2025 年 1 月 10 日

I use this plugin on all my sites. It takes snapshots of the database and allows
me to revert to some version. 1.2, 1.3 and so on. Really good and it just “works”.
Definitely download this. Cheers.

![](https://secure.gravatar.com/avatar/be7b55bbe8add3a195803d0ee663f15427ac67a7cf1709c2058210d2a762da9f?
s=60&d=retro&r=g)

### 󠀁[Doesn’t work on wordpress.com](https://wordpress.org/support/topic/doesnt-work-on-wordpress-com/)󠁿

 [toomanyphils](https://profiles.wordpress.org/toomanyphils/) 2024 年 2 月 22 日

When activating this plugin I get an error saying the wp executable doesn’t exist.
Now, I don’t have ssh access to my client’s site, but wordpress.com says wp-cli 
is pre-installed. So either wordpress.com’s documentation is incorrect, or this 
plugin uses a hardcoded path to the executable which doesn’t match wordpress.com’s
installation directory

![](https://secure.gravatar.com/avatar/05cb123d7962898785a6e4ad044f20f04ff70867ca07775ae9ae7e3a50e46bda?
s=60&d=retro&r=g)

### 󠀁[Very usefull plugin during site development phase](https://wordpress.org/support/topic/very-usefull-plugin-during-site-development-phase/)󠁿

 [djek](https://profiles.wordpress.org/djek/) 2023 年 9 月 18 日

This plugin is very usefull when you need to make small modifications during your
site development phase. You can very quickly roll back to the previous version of
your site. I had some difficulties to get everything working but the developer was
very helpfull and provided options on how to solve the problem. Thanks a lot for
such a useful plugin!

 [ 閱讀全部 3 則使用者評論 ](https://wordpress.org/support/plugin/snapshots/reviews/)

## 參與者及開發者

以下人員參與了開源軟體〈SnapShots〉的開發相關工作。

參與者

 *   [ EverPress ](https://profiles.wordpress.org/everpress/)
 *   [ Xaver ](https://profiles.wordpress.org/xaverb/)

[將〈SnapShots〉外掛本地化為台灣繁體中文版](https://translate.wordpress.org/projects/wp-plugins/snapshots)

### 對開發相關資訊感興趣？

任何人均可[瀏覽程式碼](https://plugins.trac.wordpress.org/browser/snapshots/)、查看
[SVN 存放庫](https://plugins.svn.wordpress.org/snapshots/)，或透過 [RSS](https://plugins.trac.wordpress.org/log/snapshots/?limit=100&mode=stop_on_copy&format=rss)
訂閱[開發記錄](https://plugins.trac.wordpress.org/log/snapshots/)。

## 變更記錄

#### 2.8.2

 * instructions for namespaces
 * update github workflow, no actual changes to the plugin

#### 2.8.1

 * updated file strucutre

#### 2.8.0

 * Tested up to PHP 8.3
 * fixed: redirects now work with fragments in URLs
 * change: current snapshot names is now stored in the database (not in the localstorage
   anymore)

#### 2.7.0

 * better error handling
 * keyboard search
 * tested up to 6.1
 * implemented upgrade mechanism for future update routines

#### 2.6.0

 * fixed: Snapshots with numbers are now recognized.
 * moved to external script and styles

#### 2.5.0

 * store last use snapshots in localstorage

#### 2.4

 * Now requires at least PHP 7.0

#### 2.3

 * updated usage of CLI commands for better support

#### 2.2

 * checks for ZIPAchive and falls back to PCLZIP if not available
 * automatically checks the `home_url` and do a `search-replace` if necessary

#### 2.1

 * Updated look in the dropdown menu.

#### 2.0

 * Breaking changes: Snapshosts are now stored in a subdirectory.
 * added option to remove snapshots from the UI

#### 1.0

 * Initial release

## 中繼資料

 *  版本 **2.8.2**
 *  最後更新 **1 年前**
 *  啟用安裝數 **20+**
 *  WordPress 版本需求 ** 6.6 或更新版本 **
 *  已測試相容的 WordPress 版本 **6.7.5**
 *  PHP 版本需求 ** 7.4 或更新版本 **
 *  語言
 * [English (US)](https://wordpress.org/plugins/snapshots/)
 * 標籤:
 * [database](https://tw.wordpress.org/plugins/tags/database/)[dev](https://tw.wordpress.org/plugins/tags/dev/)
   [development](https://tw.wordpress.org/plugins/tags/development/)[snapshots](https://tw.wordpress.org/plugins/tags/snapshots/)
 *  [進階檢視](https://tw.wordpress.org/plugins/snapshots/advanced/)

## 評分

 3.7 星，滿分為 5 星

 *  [  2 個 5 星使用者評論     ](https://wordpress.org/support/plugin/snapshots/reviews/?filter=5)
 *  [  0 個 4 星使用者評論     ](https://wordpress.org/support/plugin/snapshots/reviews/?filter=4)
 *  [  0 個 3 星使用者評論     ](https://wordpress.org/support/plugin/snapshots/reviews/?filter=3)
 *  [  0 個 2 星使用者評論     ](https://wordpress.org/support/plugin/snapshots/reviews/?filter=2)
 *  [  1 個 1 星使用者評論     ](https://wordpress.org/support/plugin/snapshots/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/snapshots/reviews/#new-post)

[查看全部使用者評論](https://wordpress.org/support/plugin/snapshots/reviews/)

## 參與者

 *   [ EverPress ](https://profiles.wordpress.org/everpress/)
 *   [ Xaver ](https://profiles.wordpress.org/xaverb/)

## 技術支援

使用者可在技術支援論壇提出意見反應或使用問題。

 [檢視技術支援論壇](https://wordpress.org/support/plugin/snapshots/)