最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

php - How can I export posts with featured images, without download them

programmeradmin4浏览0评论

Exporting posts with featured images without downloading them.

I work with a site that has 10000 media in a blob and nothing is allocated in the uploads folder.

How do I export the posts without having to download the media to the upload folder?

Exporting posts with featured images without downloading them.

I work with a site that has 10000 media in a blob and nothing is allocated in the uploads folder.

How do I export the posts without having to download the media to the upload folder?

Share Improve this question edited Nov 28, 2017 at 13:57 Drupalizeme 1,6262 gold badges13 silver badges17 bronze badges asked Nov 28, 2017 at 13:22 Kaue AlvesKaue Alves 1115 bronze badges
Add a comment  | 

3 Answers 3

Reset to default 1

This is a very late response but hopefully, this helps someone.

As Narek had mentioned, you normally want to use the WordPress Importer.

Do keep in mind many people run into exhausted PHP memory issues on larger exports. I know you had mentioned 10,000 assets in the media library. You may increase the memory limit by adding the constants in this article to the wp-config.php to adjust them. Do keep in mind your web host may limit this from a higher level though in which case you may not be able to increase it past a certain point.

There are other methods of doing this over the CLI to avoid this issue.

First, you could copy over all of your assets from the other location to the new one using rsync or scp on the CLI after SSHing into your environment.

Then, one of the best methods is probably doing the MySQL export via WP-CLI if your environment allows for it and only grabbing the posts of type attachment, and associated post meta, although I've never used it yet. Check out this article. You could also use this method to run the import as well per this article.

If your server doesn't support WP-CLI, you could use this method which takes advantage of mysql and mysqldump.

If you're good with PHP/MySQL, you could also consider writing a migrate script to do it in chunks (to avoid the memory issues) if none of these options work for you. There are also scripts/plugins out there already built (although I don't personally want to vouch for any).

As you can probably tell there is no "one" answer to data migration and it's highly dependent on the environments you're working with.

You can export the demo data with WordPress Importer. Here's what you need to do:

1.Login to WordPress admin

2.Go into admin panel > Tools > Import

3.If you haven’t already, you will be prompted to install the WordPress Importer free WordPress plugin. Just install it like you would any other plugin, and after you activate it return to this screen.

  1. First, download WordPress Importer Plugin.
  2. Login to WordPress admin
  3. Go into admin panel > Tools > Import
发布评论

评论列表(0)

  1. 暂无评论