Title: WP Options Importer
Author: Matthew Boynes
Published: <strong>2014 年 4 月 21 日</strong>
Last modified: 2023 年 3 月 3 日

---

搜索插件

**该插件尚未通过WordPress的最新3个主要版本进行测试**。 当与较新版本的WordPress一起
使用时，可能不再受到维护或支持，并且可能会存在兼容性问题。

![](https://s.w.org/plugins/geopattern-icon/options-importer.svg)

# WP Options Importer

 作者：[Matthew Boynes](https://profiles.wordpress.org/mboynes/)

[下载](https://downloads.wordpress.org/plugin/options-importer.7.zip)

 * [详情](https://cn.wordpress.org/plugins/options-importer/#description)
 * [评价](https://cn.wordpress.org/plugins/options-importer/#reviews)
 *  [安装](https://cn.wordpress.org/plugins/options-importer/#installation)
 * [开发进展](https://cn.wordpress.org/plugins/options-importer/#developers)

 [支持](https://wordpress.org/support/plugin/options-importer/)

## 描述

WordPress can presently export all of its content via WXR, and then import that

through the WordPress Importer plugin. That process includes all posts, terms, menus,
comments, and users, but it doesn’t touch options. In addition to general settings,
options can include widget configurations, plugin settings, theme settings, and 
lots more. This can be very time-consuming to migrate manually. WP Options Importer
aims to fill that void and save us all a lot of time.

WP Options Importer allows you to export all options to a JSON file, and then
 you
can selectively import them into another WordPress installation. The import process
is very transparent, and it even shows you what data you’ll be importing. Lastly,
it gives you the option to override existing settings or to skip options that already
exist.

## 屏幕截图

[⌊"Options" is seamlessly integrated as a choice when exporting.⌉⌊"Options" is seamlessly
integrated as a choice when exporting.⌉[

“Options” is seamlessly integrated as a choice when exporting.

[⌊"Options" is seamlessly included in the list of importers.⌉⌊"Options" is seamlessly
included in the list of importers.⌉[

“Options” is seamlessly included in the list of importers.

[⌊Once you upload the JSON file, you're presented with a choice of which
options
you want to import and if you want to override existing options.⌉⌊Once you upload
the JSON file, you're presented with a choice of which
options you want to import
and if you want to override existing options.⌉[

Once you upload the JSON file, you’re presented with a choice of which options you
want to import and if you want to override existing options.

[⌊If you choose to import "Specific Options", you're provided with a list of
everything
in the JSON file. Check the box next to those you want included, or
uncheck those
which you don't want to include.⌉⌊If you choose to import "Specific Options", you're
provided with a list of
everything in the JSON file. Check the box next to those
you want included, or
uncheck those which you don't want to include.⌉[

If you choose to import “Specific Options”, you’re provided with a list of everything
in the JSON file. Check the box next to those you want included, or uncheck those
which you don’t want to include.

## 安装

 1. Upload the plugin to the `/wp-content/plugins/` directory
 2. 通过WordPress的“插件”菜单激活插件
 3. Navigate to **Tools → Export** and choose “Settings” to export options, or navigate
    to **Tools → Import** and choose “Settings” to import options.

## 常见问题

### When I import the default options, [some plugin]’s settings don’t transfer. What gives?

The default options are core options, or those which a plugin has indicated
 are
safe to import. You can choose “Specific Options” when importing to manually select
those which you need to import.

### I’m the author of [some plugin]. Can you add my settings to the default list?

No, but you can! We provide a filter, `options_import_allowlist` for you to add

your options to the default list. Here’s an example one might add to their plugin:

    ```
    function my_awesome_plugin_options( $options ) {
        $options[] = 'my_awesome_plugin';
        return $options;
    }
    add_filter( 'options_import_allowlist', 'my_awesome_plugin_options' );
    ```

Similarly, if you don’t want someone to ever import an option, you can add it
 to
the denylist using the `options_import_denylist` filter. As above, it would look
something like this:

    ```
    function my_awesome_plugin_denylist_options( $options ) {
        $options[] = 'my_awesome_plugin_edit_lock';
        return $options;
    }
    add_filter( 'options_import_denylist', 'my_awesome_plugin_denylist_options' );
    ```

### I operate a multisite network and some options should *never* be able to be exported or imported by the site owner. Can I prevent that?

You have two options for both exports and imports.

**Imports**

First, you can use the `options_import_denylist` filter
 and add any options to 
that array (which is empty by default). If your users have access to theme or plugin
code, this isn’t 100% safe, because they could override your denylist using the 
same filter. In those cases, there’s an emergency ripcord where you can disable 
options from ever being imported. To use this, define the constant `WP_OPTION_IMPORT_DENYLIST_REGEX`(
you’ll probably want to do this in an mu-plugin) and set it to a regular expression.
Anything matching this expression will be skipped. For example:

    ```
    define( 'WP_OPTION_IMPORT_DENYLIST_REGEX', '/^(home|siteurl)$/' );
    ```

**Exports**

Exactly the same as with imports. The filter is `options_export_denylist`,
 and 
the constant is `WP_OPTION_EXPORT_DENYLIST_REGEX`.

## 评价

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

### 󠀁[Best options exporter/importer](https://wordpress.org/support/topic/best-options-exporter-importer/)󠁿

 [wong](https://profiles.wordpress.org/wongpk/) 2020 年 10 月 6 日

Works well with the latest 5.5.1, import all necessary information, also able to
choose which options to be import.

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

### 󠀁[Best options setup ever](https://wordpress.org/support/topic/best-options-setup-ever/)󠁿

 [Jon](https://profiles.wordpress.org/jonhopstra/) 2020 年 10 月 1 日

Best ever! Old but still works great!

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

### 󠀁[Still working in 2019 for WP 5.1](https://wordpress.org/support/topic/still-working-in-2019-for-wp-5-1/)󠁿

 [mkonji](https://profiles.wordpress.org/mkonji/) 2019 年 8 月 9 日

Still working great – thanks for this!

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

### 󠀁[Excellent](https://wordpress.org/support/topic/excellent-4423/)󠁿

 [shaeirving1](https://profiles.wordpress.org/shaeirving1/) 2017 年 2 月 8 日

Excellent plugin, has helped our business in many ways

 [ 阅读所有9条评价 ](https://wordpress.org/support/plugin/options-importer/reviews/)

## 贡献者及开发者

「WP Options Importer」是开源软件。 以下人员对此插件做出了贡献。

贡献者

 *   [ Matthew Boynes ](https://profiles.wordpress.org/mboynes/)
 *   [ Alley ](https://profiles.wordpress.org/alleyinteractive/)

[帮助将「WP Options Importer」翻译成简体中文。](https://translate.wordpress.org/projects/wp-plugins/options-importer)

### 对开发感兴趣吗?

您可以[浏览代码](https://plugins.trac.wordpress.org/browser/options-importer/)，
查看[SVN仓库](https://plugins.svn.wordpress.org/options-importer/)，或通过[RSS](https://plugins.trac.wordpress.org/log/options-importer/?limit=100&mode=stop_on_copy&format=rss)
订阅[开发日志](https://plugins.trac.wordpress.org/log/options-importer/)。

## 更新日志

#### 7

 * SECURITY: Add proper escaping to all echo functions
 * SECURITY: Add nonce checks
 * SECURITY: Sanitize option name values during import
 * ENHANCEMENT: Use wp_remote_get instead of file_get_contents
 * INFO: Deprecate the use of blacklist and whitlelist in favor of denylist and 
   allowlist
 * INFO: Move class into new file
 * INFO: Enable phpcs against the WordPress standard

#### 6

 * Remove multisite site-specific exclusions

#### 5

 * Added WP_OPTION_EXPORT_BLACKLIST_REGEX
 * Breaking: Changed the `options_export_exclude` filter to `options_export_blacklist`
   to be consistent with imports.

#### 4

 * After file upload, store data in transient and immediately delete the file so
   it doesn’t linger on the server.

#### 3

 * Added blacklists
 * Fixing bug where plugin wouldn’t show in multisite when WP Importer wasn’t active.
 * Misc bug fixes

#### 2

 * Spit & polish
 * Improved error handling
 * Added file cleanup on completion
 * Misc bug fixes

#### 1

 * Brand new!

## 额外信息

 *  版本 **7**
 *  最后更新：**3 年前**
 *  活跃安装数量 **7,000+**
 *  WordPress 版本 ** 3.8 或更高版本 **
 *  已测试的最高版本为 **6.1.10**
 *  语言
 * [English (US)](https://wordpress.org/plugins/options-importer/)
 * 标签
 * [export](https://cn.wordpress.org/plugins/tags/export/)[exporter](https://cn.wordpress.org/plugins/tags/exporter/)
   [import](https://cn.wordpress.org/plugins/tags/import/)[importer](https://cn.wordpress.org/plugins/tags/importer/)
   [options](https://cn.wordpress.org/plugins/tags/options/)
 *  [高级视图](https://cn.wordpress.org/plugins/options-importer/advanced/)

## 评级

 4.9 星（最高 5 星）。

 *  [  8 条 5 星评价     ](https://wordpress.org/support/plugin/options-importer/reviews/?filter=5)
 *  [  1 条 4 星评价     ](https://wordpress.org/support/plugin/options-importer/reviews/?filter=4)
 *  [  0 条 3 星评价     ](https://wordpress.org/support/plugin/options-importer/reviews/?filter=3)
 *  [  0 条 2 星评价     ](https://wordpress.org/support/plugin/options-importer/reviews/?filter=2)
 *  [  0 条 1 星评价     ](https://wordpress.org/support/plugin/options-importer/reviews/?filter=1)

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

[查看全部评论](https://wordpress.org/support/plugin/options-importer/reviews/)

## 贡献者

 *   [ Matthew Boynes ](https://profiles.wordpress.org/mboynes/)
 *   [ Alley ](https://profiles.wordpress.org/alleyinteractive/)

## 支持

有话要说吗？是否需要帮助？

 [查看支持论坛](https://wordpress.org/support/plugin/options-importer/)