Importing WordPress attachments into Media Library


  1. Hi thanks for the tutorial, I wonder how do you export selected rows in PHPMyAdmin? the Export and select all rows didn’t work as expected because it still redirected to EXPORT tab above without filtering the query results, too bad, can you tell me how did you export selected or queried?


    • I was using phpMyAdmin 4.2.10 . Under the query results I have a box that let you print, create a graphic or export the query result. I used that export link.

  2. I owe you a beer or two! This just saved me a tonne of time – thanks so much for sharing.

    For anyone using sequel pro instead of phpmyadmin, you’ll probably find that you can’t export the query results as sql. If that’s the case then just highlight all rows of the query result, right click and ‘copy as SQL INSERT’. You can then paste into your text editor and follow the instructions as normal.

    I did find that the code I pasted into sublime text didn’t contain references to INSERT INTO SENTENCES for the post meta – just regular inserts but it worked just fine. Also, my regex was slightly different to account for the space and comma after the post meta id so basically mine looked like this: (\([0-9]+,\s)

    Hope that helps someone using sequel pro. Thanks again for posting!

  3. Thanks so much for an informative and detailed post.

    For those who prefer VIM for editing text files, here is the regex I used to remove all of the meta_id values from the wp_postmeta insert queries.

    :%s/^([0-9]*, /(/g

Leave a Reply to Argie Cancel reply

Your email address will not be published. Required fields are marked *

Subscribe and stay tuned!

We are not spammy. Subscribe to get plugin updates, discounts and important news.

Powered by WordPress Popup