Widgets draw a lot of people to WordPress. Many bloggers (myself included) came to WordPress from other platforms initially because of the flexibility and utility that widgets (and plugins, too, to be fair) provide. You can do so much with them that when you’ve found the right set up for you and your audience, you don’t want to change. You want to keep using that set up on all your other sites, too. Thankfully, transferring them from one site to another with a widget importer is pretty easy.
Importing and Exporting WordPress Widgets
The WordPress widgets menu (Appearance – Widgets) is where the magic happens. You pick, choose, and customize whichever widgets will grace your blog’s sidebars and footers. And once you have those chosen and set up perfectly — which may take a good, long time — you don’t want to do it again. Especially if you used a lot of custom code snippets or anything else that had to be copy/pasted in over and over.
When You’re Ready to Rock
Once you have that perfect, head over to the WordPress.org plugin repository and grab yourself the plugin called Widget Importer & Exporter. Obviously install it and activate it, too.
Now you will have a new menu item at Tools – Widget Importer & Exporter. You can access it either in the dashboard sidebar or the Installed Plugins page. Regardless, when you get there, you’ll see buttons for the two things this plugin does best: Import Widgets and Export Widgets. The plugin doesn’t have any other set up than that. Just click and go.
Now, the important part to notice is that under Export Widgets (#2, above), the plugin states that it will create an export file for all active widgets. That means only the widgets that are currently displayed inside a sidebar, footer, or other widgetized area will be exported. So you don’t have to deal with blank copies of the 20 default widgets you may not be using.
Clicking the Export Widgets button will generate a .wie file for your URL that you can save wherever you want.
The .wie filetype is for this plugin only. You can easily see how it exports the data, however, by opening the file in a code editor. WordPress keeps widget data as a serialized array in the database, so that’s what you’re looking at here. Technically, you can go in and find and move this stuff manually using SQL, but I doubt you’d want to.
Onward to Importing!
Importing the file, however, is a little more complicated (but not by much). You will need access to whichever WordPress site you’re transferring the widgets to. Not only access, but you will also need permission to install and activate plugins because you’re going to have to install the Widget Importer & Exporter plugin on the second site as well.
Side note: Notice the different color used for the admin dashboard? This option can be changed in your user profile, and it is a very good idea when dealing with multiple WordPress installations to use various color schemes. It helps keep them separated. And it’s kind of a miracle when working on transferring data between two different installations like this. Give it a shot.
Once it’s installed and activated, just click on the Import/Export link or go to the Tools – Widget Importer & Exporter tab. Find the .wie file wherever you saved it on your hard drive or server. When ready, you just have to click the Import Widgets to initiate the process.
Immediately following, the plugin redirects you to the results summary. If everything went smoothly (which it likely did), you will see green imported messages indicating you were successful.
When you check your Appearance – Widgets screen, you get an eye-full of success. All your areas and widgets are exactly like you left them on the initial site.
Perfecto! The moment the import is done, the widgets go live. Simple as pie, as they say.
What About Duplicate Widgets?
While you can manually create duplicates of widgets, if you try to import the same widget twice, you won’t be able to. A widget already exists message in orange text will show instead of the green success one. That way, you don’t have to worry about importing the same widgets that you just exported and pushing live a duplicate of everything. (Which is also protected by changing your dashboard colors, too, remember.)
What About My Existing Widgets?
The widgets that you already have installed on your site are safe, too. Whenever you import anything using this plugin, the new plugins are simply appended to the widgetized areas. Instead of overwriting your existing set up. So as long as you’ve done some house-cleaning so that your sidebar et al don’t overextend their bounds, you may have next to no work to do beyond the import stage.
One Small Catch: Widget Areas
Because of the way the data is stored in the array within the .wie file, there’s no room for interpretation. The plugin looks for a widget area called Sidebar to dump all your Sidebar‘s widgets into. Same goes for Footer Area #1 and so on. But if you just have Footer A instead, it doesn’t know what to do. There is no 1:1 match. And the array can’t semantically interpret that title as being functionally the same thing.
So it puts anything that it can’t find a place for in your Inactive Widgets area under Appearance – Widgets. That’s where you put your widgets whose settings you want to save, but don’t want to show up on your site. So you maintain the integrity of the import itself, but you do need to go and put them in place manually. No data is lost, though.
And We’re Done!
See? It’s a really painless, easy process to transfer WordPress widgets from one site to another. A few clicks and you’re done. And if you’re going to a completely new site using the same theme (and haven’t made any customized widget area names), you can be finished with this in a handful of minutes. You did the work ages ago, getting everything just right on the first site, so why reinvent the wheel? Just export that database array as a .wie and toss it into the new site, and you can move onto work that you haven’t done already.
What reasons have you had to use the same widgets on multiple WordPress installations?
Article featured image by Tokarchuk Andrii / shutterstock.com
The post How to Import and Export WordPress Widgets Between Sites appeared first on Elegant Themes Blog.WordPress Web Design