post_type menu items skipped with multi-wxr and wp-cli
-
Hello,
I’ve cross-posted this to Github at the WP-CLI repo, but it’s something that this plugin could solve fairly easily. https://github.com/wp-cli/wp-cli/issues/2527
There seems to be a bug that sometimes causes the import to skip importing menu items, unless they are custom menu items. It seems like it might only happen when the menu item post is located in a different WXR file from the content post. It doesn’t matter that the WXR with the content post was imported before the WXR with the menu item post.
Here are the mechanics as I have been able to identify them:
wp-cli/php/commands/import.php (wp-cli)
The __invoke method in this file discovers the wxr files and imports them one by one, by calling the import_wxr method each time. That method creates a new instance of WP_Import and imports the file.wordpress-importer/wordpress-importer.php (WordPress Importer plugin)
On line 802, the WP_Import->process_menu_item method checks that the content referred to by the post_type menu item exists – and it does this by checking whether it was imported within the same file. It determines that by checking $this->processed_posts.This plugin doesn’t seem to be built to accommodate multi-WXR imports – the wp-cli command adds that functionality. It’s something that this plugin COULD solve, by also checking whether the post exists in the database, but does not.
- The topic ‘post_type menu items skipped with multi-wxr and wp-cli’ is closed to new replies.