Skip to content

Commit 6fc4eb1

Browse files
committed
Prevent caching plugins from caching markdown responses
1 parent 04c4535 commit 6fc4eb1

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

post-content-to-markdown.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,16 @@
2525
}
2626
}
2727

28+
/**
29+
* Tell caching plugins (WP Super Cache, etc.) to skip caching for markdown requests.
30+
* This runs early to ensure the constant is set before caching plugins check it.
31+
*/
32+
add_action('plugins_loaded', function () {
33+
if (isMarkdownRequested() && !defined('DONOTCACHEPAGE')) {
34+
define('DONOTCACHEPAGE', true);
35+
}
36+
});
37+
2838
/**
2939
* Check if Markdown format is requested via Accept header or query parameter
3040
*/

0 commit comments

Comments
 (0)