brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: wp import loads a WordPress WXR file and maps the authors for you

WordPress
~/tips/tip-wordpress-import-wxr-authors

wp import site.wordpress.2026-11-30.000.xml --authors=create

Imports an export file from the terminal and creates or maps the post authors.

The browser importer times out on big files. From the terminal there is no PHP time limit in the way.

wp import is a front end for the WordPress Importer plugin, so install that first:

wp plugin install wordpress-importer --activate
wp import site.wordpress.2026-11-30.000.xml --authors=create

The --authors option decides what happens to the people in the file. create makes a user for every author that does not exist yet. skip leaves author mapping out. And if you give it a filename like mapping.csv, it writes a CSV you can edit to map old authors to existing accounts, then reads it on the next run. That last one is my favourite when the target site already has its own users.

Images take most of the time, because each attachment is downloaded from the old site and all thumbnail sizes are generated. --skip=image_resize skips the thumbnails, and you can create them later with wp media regenerate. --skip=attachment leaves the media out entirely.

Because attachments come from their original URLs, the old site has to be online while you import. If it is already gone, copy its uploads folder over first and leave the media out of the import, or try --source-dir, which looks for the files locally but needs a nightly WP-CLI build.

Further reading: wp import, WordPress Importer plugin

More WordPress tips wp user application-password create anna backup-script --porcelain define( 'MEDIA_TRASH', true ); wp cli check-update wp theme delete --all wp media image-size All WordPress tips (85) All topics

Link