Automatically serves Markdown versions of all WordPress pages and posts. Append .md to any post/page URL to get its Markdown representation.
Page to MD lets you access any WordPress page or post as clean Markdown by simply appending .md to its URL.
For example, if your post lives at https://example.com/hello-world, visiting https://example.com/hello-world.md will return a Markdown version complete with YAML front-matter metadata.
- Zero configuration — activate the plugin and every public post/page instantly gets a
.mdendpoint. - YAML front-matter — each Markdown response includes title, date, author, and excerpt metadata.
- Built-in caching — converted Markdown is cached using the WordPress Transients API and automatically invalidated when a post is updated.
- Hierarchical pages — supports parent/child page structures (e.g.
parent/child.md). - Password-protected posts — returns a 403 response instead of leaking protected content.
- Proper HTTP headers — serves
text/markdowncontent type,Last-Modified, andCache-Controlheaders. - Developer-friendly — multiple filters available to customise post types, cache TTL, cache keys, and more.
- Feed your WordPress content into static site generators or documentation tools.
- Provide a machine-readable Markdown API for your content.
- Enable AI tools and LLMs to consume your content in a clean text format.
- Back up or migrate content in Markdown format.
- WordPress 5.0 or higher
- PHP 7.4 or higher
- Go to the Releases page and download the latest
.zipfile. - Upload the zip via Plugins → Add New → Upload Plugin in WordPress, or extract the
page-to-mdfolder into/wp-content/plugins/. - Activate the plugin through the Plugins screen in WordPress.
- That's it! Append
.mdto any post or page URL to get the Markdown version.
The release zip includes all required dependencies. If you clone the repository directly, you'll need to install them yourself:
- Clone the repository into
/wp-content/plugins/:git clone https://github.com/harshanas/page-to-md.git
- Install Composer dependencies:
cd page-to-md composer install --no-dev - Activate the plugin through the Plugins screen in WordPress.
Simply add .md to the end of any post or page URL. For example:
https://example.com/my-post.md
By default, only post and page types are supported. You can add custom post types using the page_to_md_allowed_post_types filter:
add_filter( 'page_to_md_allowed_post_types', function ( $types ) {
$types[] = 'product';
return $types;
} );Yes. If your page URL is https://example.com/parent/child, the Markdown URL is https://example.com/parent/child.md.
No. Password-protected posts return a 403 Forbidden response when accessed via the .md endpoint.
Yes. Use the page_to_md_cache_ttl filter:
add_filter( 'page_to_md_cache_ttl', function ( $ttl, $post_id ) {
return 2 * HOUR_IN_SECONDS;
}, 10, 2 );Yes. The cache is invalidated whenever a post is saved, updated, or trashed.
No. The plugin automatically flushes rewrite rules on activation.
| Filter | Description | Default |
|---|---|---|
page_to_md_allowed_post_types |
Control which post types can be served as Markdown. | ['post', 'page'] |
page_to_md_cache_ttl |
Adjust the cache lifetime in seconds. | 3600 (1 hour) |
page_to_md_cache_key_parts |
Add custom components to the cache key (e.g. user role). | [] |
page_to_md_use_cache |
Enable or disable caching per request. | true |
- Initial release.
- Markdown endpoint for posts and pages via
.mdURL suffix. - YAML front-matter with title, date, author, and excerpt.
- Transient-based caching with automatic invalidation.
- Support for hierarchical page slugs.
- Password-protected post handling.
- Developer filters for post types, cache TTL, cache keys, and cache toggling.
This plugin is licensed under the GPLv2 or later.
