It is critical for development that your local environment accurately reflects your remote site. In this lesson, you will learn how to import plugins, configuration, and content from a remote to a local WordPress instance.
There are a few steps to do this:
wp-content
folder over to your local siteInstructor: [0:00] When developing a WordPress instance, you'll often have a remote version of your site and a local version of your site, or maybe you'll have a remote version of the site that you want to develop locally. Here I have the WP content and the content XML from a site that I'm working on.
[0:15] I have an empty fresh WordPress instance. What I want to do is to make this local instance mirror the remote instance we're working with. What we need to do is move our WP content folder and import our content.
[0:31] Here I am with my fresh site. All I'm going to do is I'm going to copy my WP content folder into my public folder, and replace everything that's in it. We look at plugins now. We'll see that we have got lots of plugins here but none of them have been activated. We will activate our plugins.
[0:48] Let's activate WPGraphQL. Let's activate GraphQL Gutenberg. Activate GraphQL for ACF fields, but that's probably going to require having ACF fields installed, which is custom fields.
[0:59] We activate all of these. Don't need FakerPress. Activate REST API blocks. I don't need that. I've got all my plugins installed and activated, and now I'm going to import my content.
[1:09] Import. I'm going to import by WordPress. I'm going to click Install here first. I'm going to run the importer, which is going to get me to the file. I've got this headless WordPress file. Upload File and Import.
[1:21] We've got these options assigned. No Authors, actually, I already exist. Kevin already exists. The rest of them are new, and we can create them. Import Attachments, sure why not? Let's download and import attachments, and submit.
[1:32] You can see, I had two problems, importing the media, and had an invalid post type of chairs. Let's fix the post type of chairs. For post types that are created using the Post Type UI, we need to explicitly export them.
[1:48] We're going to go to Tools. Export. I'm going to select all of the JSONs here on our live remote site and paste it here and import in our local site. Successfully imported. Now we see our Chairs, Custom Types there.
[2:03] If we go back to Tools and Import, run the WordPress importer again, choose our file, again, match this to Kevin, download and import, submit.
[2:13] Now, if we go to Chairs, we can see all of our chairs are there. If we go to Pages, we can see all of our pages are there. If we go to Comments, we can see all of our comments are there.