Moving WordPress: Using Plugins to Move Your Site

If you’ve never moved a WordPress site before, you’ll find that it isn’t as straightforward as moving a static website. In the introduction to this series, I described in detail what you need to move and the considerations you may need to be aware of.

However, moving a WordPress site can be very easy if you use a plugin. Here I’ll look at some of the free plugins that can help you do this.

What You’ll Need

To follow this tutorial, you’ll need:

  • An installation of WordPress with themes and plugins running on it plus some content—posts, pages, media, or whatever happens to be in your site!
  • A second location which you want to move your site to.

The plugins below will only work with a single-site WordPress installation: if you need to move Multisite you’ll need to follow the tutorial on moving a Multisite network.

Note: I’ve tested the plugins below on my own site and they all worked as detailed. However I can’t guarantee that they will work perfectly for you and can’t answer support questions in the comments: if you have any problems, please use the support forum for the relevant plugin on the WordPress plugin repository for help.

Finding a Plugin to Help You Move Your Site

There are a number of migration plugins to help you move your site, but for a very simple move you might find that plugins to import content do the job.

I’m going to look at two categories of plugin here:

  • importer plugins
  • migration plugins

Importer Plugins

There are free plugins that will let you export content from one WordPress site and then import it into another. Let’s take a look at them.

WordPress Importer Plugin

If your new site is running themes and plugins that you can install without copying them (e.g. from the plugin or theme directory), all you’ll need to copy is the content itself.

The WordPress Importer plugin lets you do this: not only does it import the contents of your posts, pages etc., but it’ll also import the media files you’ve attached to your posts and the authors of your content.

 To use the plugin you follow these steps:

In your old site, click on Tools > Export to open the Export screen. Delete the post types you want to export, then click Download Export File to export your content to an xml file:

Export content to an xml file

In your new site, install the WordPress Importer plugin, and then click on Tools > Import. Select WordPress, then select the xml file which was downloaded to your computer from the old site. Click on Upload file and import, and follow the instructions on-screen for importing attachments and authors.

You’ll now find that your new site contains all of the content from your old site.

Note: If you have plugins set up and configured on your old site, or you’ve used the Theme Customiser to tweak your theme, this method won’t copy any of that configuration. You’ll need to use a migration plugin or do a manual move instead. If you have widgets configured, the next plugin can help with that.

Widget Settings Importer/Exporter Plugin

Using the WordPress Importer won’t import any widgets you’ve added to your site, and if you’ve got a few, adding them fresh to your new site can be a pain. However, help is at hand. The Widget Settings Importer/Exporter plugin will export widget settings from your old site and import them to the new.

To use it, follow these steps:

  1. Install and activate the plugin on both sites.
  2. Make sure that the theme that was activated on your old site is also activated on your new site. This is important as the widgets need to go into the same widget areas.
  3. Make sure that you have all the same plugins installed and activated on both sites. This is important if any of your widgets are supplied by plugins.
  4. In the old site, click on Tools > Widget Settings Export. Select the widgets you want to export and click on Export Widget Settings to download a json export file.
  5. In the new site, click on Tools > Widget Settings Import. Select the json file you downloaded and click on Show Widget Settings to see the widgets to be imported. Select the ones you want to import, and click Import Widget Settings to import your widget settings.

You’ll now find that your widgets are the same for both sites. Sometimes it’s necessary to make a few tweaks, for example if a widget is in a different widget area, but as long as you have the same theme activated on both sites, it should work.

Migration Plugins

Sometimes the importer plugins aren’t enough for your site. For example, if you’ve spent time configuring plugin settings, these won’t be imported and you’ll have to do it all over again. Or if you’ve customized your theme using the Theme Customizer, this also won’t be imported.

If this is the case, you’ll need a plugin that migrates the contents of your old site’s entire database to the new site.

The All-in One WP Migration plugin is free and lets you download one site’s database and files and then upload them to another site. It edits the database for you so that all of your links work on the new domain if you’re changing domains. Let’s take a look at how to use it.

Exporting the Old Site

Firstly, install the plugin in your old site and activate it. You’ll see a new admin menu item called Site Migration.

In your old site, go to Site Migration > Export to see this screen:

Export site using All-in-One WP MIgration

Tick the checkboxes for anything you don’t want to migrate. Here I’m not migrating plugins and theme files, as I already have them set up on my new site. However, if you are doing this, make sure you install and activate the correct themes and plugins on your new site before migrating, so that the settings for them which will be migrated across in the database work correctly.

Click Export and a zip file will be downloaded to your local machine.

Note: If you’re using Safari, you may find that it unzips the file on download. Zipping it up again in File Manager won’t work. To stop the zip file from being unzipped, go to Safari > Preferences > General, and uncheck the Open “safe” files after downloading box.

Importing to the New Site

In your new site, install and activate the migration plugin. Go to Site Migration > Import and upload the zip file you just downloaded.

Depending on how big your old site was, this may take a while—I used the WordPress theme test unit data and it took about half an hour. 

Import site using All-in One WP Migration

The plugin will upload the file and instate all of the content, files and settings from your old site in the new one. It will also change any links using your old domain to the new one.

Before finishing, visit the Settings > Permalinks screen twice to refresh permalink settings. You don’t actually have to save your permalink settings again: just visiting the screen flushes your rewrite rules and updates the permalinks.


If you’re new to moving a WordPress site, using a plugin will be a less daunting way to proceed than doing things manually. The two options above will enable you to migrate your site to a new location without having to manually edit your database or use FTP.

However, there will be times when you have to migrate WordPress manually, which is what I’ll be covering in the rest of this series.

from Tuts+ Code – WordPress

Create a Simple CRM in WordPress: Extending WordPress Search to Include Custom Fields

We’ve been looking at how to create a simple CRM system in WordPress. In the last part of this series, we added code to our plugin which allowed us to display our Advanced Custom Fields in the WordPress List Table (WP_List_Table), and sort our data alphabetically by those new fields.

Today we’ll cover how to extend the search functionality to include the data stored in our Custom Fields.

Search Functionality

Each Post Type that has an Administration Interface comes with a search box:

WordPress Search Box

By default, when a user searches for Post(s) in the WordPress Administration interface, WordPress will search the wp_posts table to find any partial content matches across the following fields:

  • Title
  • Content
  • Excerpt

If we try to search for a partial phone number, we’ll see that no results appear:

Searching our Advanced Custom Fields Data doesnt work

For our Contact Custom Post Type, this isn’t very useful if we want to find a contact by phone number or email address!

Advanced Custom Fields stores its data in the wp_postmeta table, which WordPress doesn’t search by default. We need to use two of WordPress’s provided filters to allow WordPress’s search functionality to also search Advanced Custom Fields data. These filters will:

  1. perform an SQL JOIN between the WordPress Post Meta table and the WordPress Posts table
  2. append an SQL WHERE clause to the WordPress Post Query to search our WordPress Posts Meta table

Performing an SQL JOIN

Let’s start by adding the posts_join filter to our plugin class’s construct to join the WordPress:

We also need to define our search_meta_data_join() function, which tells WordPress which table we want to join to the main WordPress Posts table:

get_query_var() is a function which returns the appropriate query variable stored in the WP_Query class. WP_Query is a WordPress class which provides:

… information defining the current request… what type of query it’s dealing with (possibly a category archive, dated archive, feed, or search), and fetches the requested posts. It retains a lot of information on the request, which can be pulled at a later date.

get_query_var() is the magic that lets us ‘pull’ that information. In this case, we check the query variable 's', telling us what search term (if any) the user has requested. We also use this same function to check which Post Type(s) the user is requesting—we only want to extend our search if the user is looking at the Contact Custom Post Type.

If these conditions are met, we join the wp_postmeta table to the main wp_posts table.

$wpdb is also used here, and it’s a defined class which:

… contains a set of functions used to interact with a database. Its primary purpose is to provide an interface with the WordPress database, but can be used to communicate with any other appropriate database.

In short, $wpdb lets us access the MySQL database, get configuration settings and perform SQL queries.

In this case, we use $wpdb to get the names of the Post and Post Meta tables, because these can be modified by each WordPress installation. For example, one installation might set its table name prefix to wp_ (which is the default), whilst another installation might set it to my_awesome_site_. We can’t hard code table names, as we can’t guarantee they’ll always be wp_posts and wp_postmeta, so we use $wpdb->posts and $wpdb->postmeta, which contain the actual table names specific to that WordPress installation.

Appending to the SQL WHERE Clause

With our SQL JOIN complete, we now need to tell WordPress to search the joined Post Meta table.

Go back to the plugin’s __construct(), and add a new function to the posts_where filter:

We also need to define our search_meta_data_where() function, which tells WordPress to search our Post Meta data:

In the same way as we did in search_meta_data_join(), we again check that the WordPress Query is a search on the Contacts Custom Post Type. If it isn’t, we return the $while clause without modification.

If we need to modify the $while clause, we do this by:

  • getting the start of the WHERE clause: ' AND(('
  • getting the remainder of the WHERE clause
  • injecting our WHERE clause to search the Post Meta table’s meta_value column for any instance of our search term
  • adding an OR condition to the end of our WHERE clause, appending the rest of the query to it
  • grouping the results by the Post ID

We need to group the results because there will typically be more than one entry in the Post Meta table for a given Post ID. Because we set up a JOIN between the Posts and their Post Meta, if we didn’t group the results, we’d get the same Post repeating in our table.

To check that our JOIN and WHERE clauses have worked, reload your Contacts Table, and try to search for one of your contacts by part of their phone number:

We can now search our Advanced Custom Fields

If it works, congratulations! You can now search by any Advanced Custom Fields you specify in your CRM system.

Up Next…

In the next article, we’re going to restrict and hide WordPress Administration functionality and menu items that we don’t need for our CRM.

from Tuts+ Code – WordPress

Weekly News for Designers (N.280)

This is our popular weekly design news post where we share our favorite design related articles, resources and freebies from the past week.

You can sign-up to our awesome weekly newsletter for some more amazing weekly articles, resources and freebies.

New Resources & Tools

Typora, a new minimal markdown writing app.
Typora, a new minimal markdown writing app

Project Titon Toolkit, a collection of extensible UI components.
Project Titon Toolkit, a collection of extensible UI components

Svidget.js, a JavaScript framework for building fantastic SVG widgets.
Svidget.js, a JavaScript framework for building fantastic SVG widgets

Free Ebook: Web UI Trends Present & Future (Typography).
Free Ebook: Web UI Trends Present & Future (Typography)

New Learning Resources

Comparison of all CSS font sizing by Ire Aderinokun.
Comparison of all CSS font sizing by Ire Aderinokun

The best UI typeface goes unnoticed by Ire Aderinokun.
The best UI typeface goes unnoticed by Ire Aderinokun

How to write cleaner CSS and smarter SASS by Anthony Dispezio.
How to write cleaner CSS and smarter SASS

Dear web designer, let’s stop breaking the affordance of scrolling by Rodrigo Muniz.
Dear web designer, let’s stop breaking the affordance of scrolling by Rodrigo Muniz

Responsive Logos: Tips for Adapting Logos for Small Screens by Jeremy Frank.
Responsive Logos: Tips for Adapting Logos for Small Screens

Beyond Firefox, Chrome And IE: Some Lesser Known Browsers by Daniel Herken.
Beyond Firefox, Chrome And IE: Some Lesser Known Browsers

R.I.P. REM, Viva CSS Reference Pixel! by Gion Kunz.
R.I.P. REM, Viva CSS Reference Pixel!

Alternatives to the hamburger menu by Benjamin Berger.
Alternatives to the hamburger menu

User experience design is not what you think by Paul Boag.
User experience design is not what you think

Semantic HTML for Web Content by Jacob Gube.
Semantic HTML for Web Content

Free GUI Resources Resources

Freebie: 50 Resources for Web Designers from March 2015
Freebie: 50 Resources for Web Designers from March 2015

Freebie: Material Design UI Kit (PSD)
Freebie: Material Design UI Kit PSD

Freebie: Wireframer Icon Pack (25 icons, SVG).
Freebie: Wireframer Icon Pack 25 icons, SVG

…and finally… coding itself: coding itself

You may also like to browse the Weekly News Archives.

The post Weekly News for Designers (N.280) appeared first on Speckyboy Web Design Magazine.

via Speckyboy Web Design Magazine