I’m currently developing an updated version of a live site in a local environment. It’s a very large site and the local dev site is using a entirely new theme without many of the live site’s plugins or functionality. The live site uses Avada Fusion and almost all content is wrapped in shortcodes forcing me to basically re-publish each post manually using the dev site’s new setup (using ACF Pro, custom fields). I’ve spent weeks removing the live site theme, unnecessary thumbnails, plugins, and all sorts of space hogging files. The only problem is bringing in the new posts from the live site. They are adding new posts weekly and I’m about 25 behind. 🙂
Is there a way to export/import the new posts from the live site into the local dev site that would include all the posts’ featured images, galleries within the post, etc? This would only be for posts, and I would love to pull from a specific date like May 15 to Current.
I attempted the standard Tools > export/import and it added the posts ok but it didn’t include featured images or any of the images within the posts. I’m curious about plugins like WP Migrate DB Pro and their merge feature but I don’t want to overwrite or add back any of the images I’ve painstakingly removed or regenerated with lossless compression.
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
Have you considered to use REST API to bridge the two environments?
Basically you need to hit the posts endpoint https://example.com/wp-json/wp/v2/posts using the after argument that permit to limit response to posts published after a given ISO8601 compliant date.
With the response you can insert new posts and sync the two installation.
More detail about the endpoint and the arguments can be found here https://developer.wordpress.org/rest-api/reference/posts/
Method 2
Thank you for the responses. I was able to get it handled by using a plugin.
https://wordpress.org/plugins/export-media-with-selected-content/
I’m going to look into the REST API solution for keeping it up to date while I continue the development side of the project.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0