Introducing WP2Bear, a WordPress plugin to help you migrate your blog posts to bearblog.dev. The plugin exports WordPress posts to Markdown files with front matter block compatible with Bear. It also provides granular options to customize metadata, including bulk overrides for meta images, aliases, and canonical URLs.
Features
- Export WordPress Posts to Markdown: Convert WordPress posts and pages into Markdown files with frontmatter blocks.
- Customizable Metadata: Override domains for meta images, aliases, and canonical URLs.
- Tag and Category Support: Export tags and categories as Markdown tags.
- Yoast SEO Integration: Automatically extract meta descriptions and canonical URLs from Yoast SEO if installed.
- Bulk Export: Export all published posts (and pages) or the entire post database (including drafts).
- Customizable Settings: Configure fallback meta descriptions, meta images, lang, etc.
Installation
- Download the plugin ZIP file.
- Inspect the
wp2bear.php
file for security. - Upload the plugin folder to your WordPress
wp-content/plugins
directory. - Activate the plugin in Plugins > Installed Plugins in WordPress.
- Navigate to Tools > WP2Bear to configure and use the plugin.
Usage
- Settings: Go to Tools > WP2Bear to configure plugin settings such as fallback meta descriptions, meta images, and domain overrides.
- Export Posts:
- Click Export Published Posts to export all published posts and pages.
- Click Export All Posts to export all posts, including drafts and private posts.
- Download ZIP: The plugin will generate a ZIP file containing all exported Markdown files.
Settings Explained
- Convert Post Content: Choose whether to convert post content to Markdown or keep it as WP-flavored HTML.
- Fallback Meta Description: Specify a default meta description if none exists.
- Fallback Meta Image: Define a default image for posts without featured images.
- Make Discoverable: Enable or disable discoverability on Bearblog.
- CSS Class Name: Assign a class name for styling.
- Language Code: Enter the language code of your blog.
- Tag Source: Choose whether to use WordPress tags, categories, or both.
- Override Image Domain: Adjust image URLs in exported posts. If you've migrated your WordPress uploads folder to a different hosting provider, this ensures your images load from the correct source.
- Override Alias & Canonical Domain: The alias global prefix is useful if you have a unique permalink structure in WP and want to carry it over to Bear. By overriding the canonical domain, you ensure search engines are directed to the correct location.
My Test Environment
- PHP 7.4.33 & 8.1.29
- WordPress 6.7.1
FAQ
1. Can I export pages as well as posts?
Yes, the plugin supports exporting both posts and pages.
2. What happens if there is no featured image or meta description?
If no featured image or meta description is found, WP2Bear will use the fallback values provided in the settings. If no fallbacks are specified, these fields will remain empty.
3. Can I use this plugin to simply export WP posts to markdown files?
Yes. While WP2Bear is designed to integrate with bearblog.dev, the exported Markdown files are compatible with other platforms.
Note
WP2Bear is provided as is, without any express or implied warranties. If you remix, modify, or redistribute this plugin in any way, please credit mgx.me in your project's documentation or credits section.