Skip to content

Fix .md URLs for custom post types and date-based permalinks#3

Merged
jdevalk merged 1 commit intomainfrom
filip/fix-permalink-structure-support
Feb 15, 2026
Merged

Fix .md URLs for custom post types and date-based permalinks#3
jdevalk merged 1 commit intomainfrom
filip/fix-permalink-structure-support

Conversation

@ilicfilip
Copy link
Contributor

@ilicfilip ilicfilip commented Feb 13, 2026

Summary

  • Replace direct DB query in parse_markdown_url() with url_to_postid() which uses WordPress's own permalink resolution
  • Fixes .md URLs not working for custom post types (e.g., /product/test-product.md) and date-based permalink structures (e.g., /2026/02/hello-world.md)
  • The old approach matched post_name against the full URL path, which only worked for simple slug-based permalinks

Fixes #1 (comment)

Test plan

  • Test .md URL with plain permalink structure (/hello-world.md)
  • Test .md URL with date-based permalinks (/%year%/%monthnum%/%postname%/)
  • Test .md URL with custom post type (/product/test-product.md) using the markdown_alternate_supported_post_types filter
  • Test ?format=markdown still works
  • Test Accept header negotiation still works

🤖 Generated with Claude Code

Replace direct DB query (matching post_name against full URL path) with
url_to_postid() which leverages WordPress's own permalink resolution.
This fixes .md URLs for custom post types and date-based permalinks.

Fixes #1

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jdevalk jdevalk merged commit 0eb6051 into main Feb 15, 2026
@jdevalk jdevalk deleted the filip/fix-permalink-structure-support branch February 15, 2026 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Integrate with Yoast SEO llms.txt to use .md URLs instead of HTML URLs

2 participants