On this page
Advanced WordPress Migrate
Last updated on
30 April 2025
Extending WordPress migration classes
The builtin wordpress_migrate classes can be extended for custom situations, such as mapping incoming postmeta data to node fields. The basic approach:
1. Extend the appropriate class, such as the WordPressBlogEntry class with your custom behavior - add field mappings in __construct(), manipulate the body ($row->content) in prepareRow(), etc.
2. Extend the WordPressBlog class, and override migrationClasses to point to your custom classes:
class MyCustomBlog extends WordPressBlog {
public function migrationClasses() {
$classes = parent::migrationClasses();
$classes['WordPressBlogEntry'] = 'MyCustomBlogEntry';
$classes['WordPressPage'] = 'MyCustomPage';
return $classes;
}
}
3. Set the wordpress_migrate_blog_class variable to point at your WordPressBlog class. For example, add this to settings.php:
$conf['wordpress_migrate_blog_class'] = 'MyCustomBlog';
Help improve this page
Page status: Not set
You can:
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion