{"id":29024,"date":"2014-04-21T21:27:11","date_gmt":"2014-04-21T21:27:11","guid":{"rendered":"https:\/\/wordpress.org\/plugins-wp\/options-importer\/"},"modified":"2023-03-03T14:46:05","modified_gmt":"2023-03-03T14:46:05","slug":"options-importer","status":"publish","type":"plugin","link":"https:\/\/mya.wordpress.org\/plugins\/options-importer\/","author":6535998,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"7","stable_tag":"7","tested":"6.1.10","requires":"3.8","requires_php":"","requires_plugins":"","header_name":"WP Options Importer","header_author":"Matthew Boynes","header_description":"","assets_banners_color":"","last_updated":"2023-03-03 14:46:05","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"https:\/\/github.com\/alleyinteractive\/options-importer","header_author_uri":"https:\/\/www.alley.com\/","rating":4.9,"author_block_rating":0,"active_installs":7000,"downloads":103818,"num_ratings":9,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","faq","changelog"],"tags":{"4":{"tag":"4","author":"mboynes","date":"2014-04-21 21:28:56"},"5":{"tag":"5","author":"mboynes","date":"2014-05-24 18:21:04"},"7":{"tag":"7","author":"mboynes","date":"2023-03-03 14:46:05"}},"upgrade_notice":{"5":"<p><strong>Breaking:<\/strong> Changed the <code>options_export_exclude<\/code> filter to <code>options_export_blacklist<\/code> to be consistent with imports.<\/p>"},"ratings":{"1":0,"2":0,"3":0,"4":"1","5":"8"},"assets_icons":[],"assets_banners":[],"assets_blueprints":{},"all_blocks":[],"tagged_versions":null,"block_files":[],"assets_screenshots":{"screenshot-1.png":{"filename":"screenshot-1.png","revision":899744,"resolution":"1","location":"assets","locale":""},"screenshot-2.png":{"filename":"screenshot-2.png","revision":899744,"resolution":"2","location":"assets","locale":""},"screenshot-3.png":{"filename":"screenshot-3.png","revision":899744,"resolution":"3","location":"assets","locale":""},"screenshot-4.png":{"filename":"screenshot-4.png","revision":899744,"resolution":"4","location":"assets","locale":""}},"screenshots":{"1":"\"Options\" is seamlessly integrated as a choice when exporting.","2":"\"Options\" is seamlessly included in the list of importers.","3":"Once you upload the JSON file, you're presented with a choice of which\noptions you want to import and if you want to override existing options.","4":"If you choose to import \"Specific Options\", you're provided with a list of\neverything in the JSON file. Check the box next to those you want included, or\nuncheck those which you don't want to include."},"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[1859,12641,87,6606,2218],"plugin_category":[59],"plugin_contributors":[79615,79614],"plugin_business_model":[],"class_list":["post-29024","plugin","type-plugin","status-publish","hentry","plugin_tags-export","plugin_tags-exporter","plugin_tags-import","plugin_tags-importer","plugin_tags-options","plugin_category-utilities-and-tools","plugin_contributors-alleyinteractive","plugin_contributors-mboynes","plugin_committers-mboynes"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/s.w.org\/plugins\/geopattern-icon\/options-importer.svg","icon_2x":false,"generated":true},"screenshots":[{"src":"https:\/\/ps.w.org\/options-importer\/assets\/screenshot-1.png?rev=899744","caption":"\"Options\" is seamlessly integrated as a choice when exporting."},{"src":"https:\/\/ps.w.org\/options-importer\/assets\/screenshot-2.png?rev=899744","caption":"\"Options\" is seamlessly included in the list of importers."},{"src":"https:\/\/ps.w.org\/options-importer\/assets\/screenshot-3.png?rev=899744","caption":"Once you upload the JSON file, you're presented with a choice of which\noptions you want to import and if you want to override existing options."},{"src":"https:\/\/ps.w.org\/options-importer\/assets\/screenshot-4.png?rev=899744","caption":"If you choose to import \"Specific Options\", you're provided with a list of\neverything in the JSON file. Check the box next to those you want included, or\nuncheck those which you don't want to include."}],"raw_content":"<!--section=description-->\n<p>WordPress can presently export all of its content via WXR, and then import that\nthrough the WordPress Importer plugin. That process includes all posts, terms,\nmenus, comments, and users, but it doesn't touch options. In addition to\ngeneral settings, options can include widget configurations, plugin settings,\ntheme settings, and lots more. This can be very time-consuming to migrate\nmanually. WP Options Importer aims to fill that void and save us all a lot of\ntime.<\/p>\n\n<p>WP Options Importer allows you to export all options to a JSON file, and then\nyou can selectively import them into another WordPress installation. The import\nprocess is very transparent, and it even shows you what data you'll be\nimporting. Lastly, it gives you the option to override existing settings or to\nskip options that already exist.<\/p>\n\n<!--section=installation-->\n<ol>\n<li>Upload the plugin to the <code>\/wp-content\/plugins\/<\/code> directory<\/li>\n<li>Activate the plugin through the 'Plugins' menu in WordPress<\/li>\n<li>Navigate to <strong>Tools &rarr; Export<\/strong> and choose \"Settings\" to export options,\nor navigate to <strong>Tools &rarr; Import<\/strong> and choose \"Settings\" to import options.<\/li>\n<\/ol>\n\n<!--section=faq-->\n<dl>\n<dt id='when%20i%20import%20the%20default%20options%2C%20%5Bsome%20plugin%5D%27s%20settings%20don%27t%20transfer.%20what%20gives%3F'><h3>When I import the default options, [some plugin]'s settings don't transfer. What gives?<\/h3><\/dt>\n<dd><p>The default options are core options, or those which a plugin has indicated\nare safe to import. You can choose \"Specific Options\" when importing to\nmanually select those which you need to import.<\/p><\/dd>\n<dt id='i%27m%20the%20author%20of%20%5Bsome%20plugin%5D.%20can%20you%20add%20my%20settings%20to%20the%20default%20list%3F'><h3>I'm the author of [some plugin]. Can you add my settings to the default list?<\/h3><\/dt>\n<dd><p>No, but you can! We provide a filter, <code>options_import_allowlist<\/code> for you to add\nyour options to the default list. Here's an example one might add to their\nplugin:<\/p>\n\n<pre><code>function my_awesome_plugin_options( $options ) {\n    $options[] = 'my_awesome_plugin';\n    return $options;\n}\nadd_filter( 'options_import_allowlist', 'my_awesome_plugin_options' );\n<\/code><\/pre>\n\n<p>Similarly, if you don't want someone to ever import an option, you can add it\nto the denylist using the <code>options_import_denylist<\/code> filter. As above, it\nwould look something like this:<\/p>\n\n<pre><code>function my_awesome_plugin_denylist_options( $options ) {\n    $options[] = 'my_awesome_plugin_edit_lock';\n    return $options;\n}\nadd_filter( 'options_import_denylist', 'my_awesome_plugin_denylist_options' );\n<\/code><\/pre><\/dd>\n<dt id='i%20operate%20a%20multisite%20network%20and%20some%20options%20should%20%2Anever%2A%20be%20able%20to%20be%20exported%20or%20imported%20by%20the%20site%20owner.%20can%20i%20prevent%20that%3F'><h3>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?<\/h3><\/dt>\n<dd><p>You have two options for both exports and imports.<\/p>\n\n<p><strong>Imports<\/strong><\/p>\n\n<p>First, you can use the <code>options_import_denylist<\/code> filter\nand add any options to that array (which is empty by default). If your users\nhave access to theme or plugin code, this isn't 100% safe, because they could\noverride your denylist using the same filter. In those cases, there's an\nemergency ripcord where you can disable options from ever being imported. To\nuse this, define the constant <code>WP_OPTION_IMPORT_DENYLIST_REGEX<\/code> (you'll\nprobably want to do this in an mu-plugin) and set it to a regular expression.\nAnything matching this expression will be skipped. For example:<\/p>\n\n<pre><code>define( 'WP_OPTION_IMPORT_DENYLIST_REGEX', '\/^(home|siteurl)$\/' );\n<\/code><\/pre>\n\n<p><strong>Exports<\/strong><\/p>\n\n<p>Exactly the same as with imports. The filter is <code>options_export_denylist<\/code>,\nand the constant is <code>WP_OPTION_EXPORT_DENYLIST_REGEX<\/code>.<\/p><\/dd>\n\n<\/dl>\n\n<!--section=changelog-->\n<h4>7<\/h4>\n\n<ul>\n<li>SECURITY: Add proper escaping to all echo functions<\/li>\n<li>SECURITY: Add nonce checks<\/li>\n<li>SECURITY: Sanitize option name values during import<\/li>\n<li>ENHANCEMENT: Use wp_remote_get instead of file_get_contents<\/li>\n<li>INFO: Deprecate the use of blacklist and whitlelist in favor of denylist and allowlist<\/li>\n<li>INFO: Move class into new file<\/li>\n<li>INFO: Enable phpcs against the WordPress standard<\/li>\n<\/ul>\n\n<h4>6<\/h4>\n\n<ul>\n<li>Remove multisite site-specific exclusions<\/li>\n<\/ul>\n\n<h4>5<\/h4>\n\n<ul>\n<li>Added WP_OPTION_EXPORT_BLACKLIST_REGEX<\/li>\n<li>Breaking: Changed the <code>options_export_exclude<\/code> filter to <code>options_export_blacklist<\/code> to be consistent with imports.<\/li>\n<\/ul>\n\n<h4>4<\/h4>\n\n<ul>\n<li>After file upload, store data in transient and immediately delete the file so it doesn't linger on the server.<\/li>\n<\/ul>\n\n<h4>3<\/h4>\n\n<ul>\n<li>Added blacklists<\/li>\n<li>Fixing bug where plugin wouldn't show in multisite when WP Importer wasn't active.<\/li>\n<li>Misc bug fixes<\/li>\n<\/ul>\n\n<h4>2<\/h4>\n\n<ul>\n<li>Spit &amp; polish<\/li>\n<li>Improved error handling<\/li>\n<li>Added file cleanup on completion<\/li>\n<li>Misc bug fixes<\/li>\n<\/ul>\n\n<h4>1<\/h4>\n\n<ul>\n<li>Brand new!<\/li>\n<\/ul>","raw_excerpt":"Export and import WordPress Options.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/mya.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/29024","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mya.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/mya.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/mya.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=29024"}],"author":[{"embeddable":true,"href":"https:\/\/mya.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/mboynes"}],"wp:attachment":[{"href":"https:\/\/mya.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=29024"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/mya.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=29024"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/mya.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=29024"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/mya.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=29024"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/mya.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=29024"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/mya.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=29024"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}