wp-markdown-editor
wp-markdown-editor copied to clipboard
Selectively inject markdown editor based on supported post types.
We added the following code to the functions.php of our theme to only add the editor for docs CPT:
function update_supported_markdown_posts() {
add_post_type_support( 'docs', WPCom_Markdown::POST_TYPE_SUPPORT );
remove_post_type_support( 'post', WPCom_Markdown::POST_TYPE_SUPPORT );
remove_post_type_support( 'page', WPCom_Markdown::POST_TYPE_SUPPORT );
}
add_action( 'init', 'update_supported_markdown_posts', 9999 );
Without the code modifications, the editor is triggered in all posts and pages.