• Resolved Alex Knight

    (@alexknight)


    I installed the plugin and noticed after duplicating a post as a draft, the post was in HTML markup and not Markdown, which is what I wrote the original post in. I’m using the Jetpack plugin. Is there any way to preserve the raw Markdown when duplicating?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Enrico Battocchi

    (@lopo)

    Hi,
    I’ve done a quick test and analysed the code for Jetpack.
    Seems like it uses the post_content_filtered field which is usually left blank, and which my plugin doesn’t take care of.

    I’ll investigate the issue to find how to solve it, shouldn’t be too hard so maybe it could be fixed in the next version.

    Thread Starter Alex Knight

    (@alexknight)

    Thanks for the quick reply and thanks for looking into the issue.

    Thread Starter Alex Knight

    (@alexknight)

    Any ETA on a fix? 🙂

    Plugin Author Enrico Battocchi

    (@lopo)

    Hi,
    the issue should be fixed following these steps:

    1. upgrade to version 3.1.1, which has been released today. This is required for the solution to work.
    2. copy and paste the following code to your theme’s functions.php:
      add_action('duplicate_post_pre_copy', 'duplicate_post_unload_markdown');
      add_action('duplicate_post_post_copy', 'duplicate_post_load_markdown');
      
      function duplicate_post_unload_markdown(){
      	if(class_exists('WPCom_Markdown')){
      		WPCom_Markdown::get_instance()->unload_markdown_for_posts();
      	}
      }
      
      function duplicate_post_load_markdown(){
      	if(class_exists('WPCom_Markdown')){
      		WPCom_Markdown::get_instance()->load_markdown_for_posts();
      	}
      }

    Can you confirm that the issues is fixed?
    Thanks in advance

    Thread Starter Alex Knight

    (@alexknight)

    Yep, that fixed it. Thanks!

    Plugin Author Enrico Battocchi

    (@lopo)

    Glad to hear that!
    Thanks for reporting!

    Plugin Author Enrico Battocchi

    (@lopo)

    Hi @alexknight,
    version 3.2, out now, should be Markdown-compatible “out of the box”, no need of the code above.
    Feel free to write if you experience any issue!

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Duplicating post doesn’t preserve Markdown’ is closed to new replies.