This WP-CLI script can be used to migrate posts from one post type to another or add posts in a specific taxonomy and term in bulk.
wp tyb migrate-post-type --from=<string> --to=<string> --per-page=<int> --offset=<int> --taxonomy=<string> --term=<string> --dry-run=<bool>
--from
: Post type slug to migrate from.--to
: Post type slug to migrate to.--per-page
: Number of posts to process per page. Default is150
.--offset
: Where in the query to start the loop. Default is0
.--taxonomy
: Taxonomy slug the desired term lives in.--term
: Term name to assign each migrated post to.--dry-run
: Boolean value. Dry run is a test run that does not execute any data. Default istrue
.
NOTE: You must set --dry-run=false
for the script to actually process the posts and migrate data.