Only Migrating Published Nodes in a D7 to D8 Migration

I’m not going into much detail here but hopefully this helps someone.

If you need to migrate only published nodes you can extend the d7_node plugin and add a condition to the query.

First, create a file in your module like /modules/custom/mysite_migrate/src/Plugin/migrate/source/MysiteNewsNode.php that extends the d7_node plugin:

Then, use the mysite_news_node source plugin instead of d7_node.

I would encourage you to have a look at the code in /core/modules/node/src/Plugin/migrate/source/d7/Node.php to see what happens in the query() method you’re extending, as well as what’s going on in prepareRows() and fields() in particular.

Leave a Reply

Your email address will not be published.