Is it possible to store posts in pure markdown format? so that I can retrieve the content through the REST API and get the markdown code, without any added html?


You can try remove_filter( 'the_content', 'wpautop' ); to remove the added HTML tags.


| improve this answer | |

You have to do two things

  1. Completely disable visual editor
  2. enable Markdown.

Disable Visual editor: Add this code in the themes function.php file or as a plugin.

add_filter( 'user_can_richedit' , '__return_false', 50 );

Enable Markdown: Install this plugin Wp-Markdown

| improve this answer | |
  • With or without the plugin activated, if I paste markdown content on the post, I get paragraph html tags thorough the text. Indeed no difference with the plugin, maybe it's not working in the final WP version? – GWorking Jan 31 '19 at 20:32
  • You must disable the richtext editor. Also wordpress has a function named "wpautop" which renders html <p> tag automatically. You have to disable that too. use this in your function file remove_filter( 'the_content', 'wpautop' ); remove_filter( 'the_excerpt', 'wpautop' ); – Sabbir Hasan Feb 3 '19 at 13:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.