wp-markdown-editor icon indicating copy to clipboard operation
wp-markdown-editor copied to clipboard

Selectively inject markdown editor based on supported post types.

Open vovafeldman opened this issue 9 years ago • 0 comments

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.

vovafeldman avatar Oct 11 '16 00:10 vovafeldman