Skip to content

Commit

Permalink
Markdown: enable for posts whenever the module is active. (#6608)
Browse files Browse the repository at this point in the history
* Markdown: enable for posts whenever the module is active.

Also remove the option from Settings > Writing.

Fixes #6605

Related:
- #6406
- #6548

* Markdown: make sure posts markdown is re-enabled on upgrade

* Remove setting checkbox from writing options page
  • Loading branch information
jeherve authored and dereksmart committed Mar 9, 2017
1 parent 175c260 commit 71752a9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions class.jetpack.php
Expand Up @@ -349,6 +349,11 @@ function plugin_upgrade() {
Jetpack_Options::delete_option( 'identity_crisis_whitelist' );
}

// Make sure Markdown for posts gets turned back on
if ( ! get_option( 'wpcom_publish_posts_with_markdown' ) ) {
update_option( 'wpcom_publish_posts_with_markdown', true );
}

Jetpack::maybe_set_version_option();
}
}
Expand Down
14 changes: 14 additions & 0 deletions modules/markdown.php
Expand Up @@ -13,3 +13,17 @@
*/

include dirname( __FILE__ ) . '/markdown/easy-markdown.php';

/**
* Remove checkbox set in modules/markdown/easy-markdown.php.
* We don't just remove the register_setting call there because the checkbox is
* needed on WordPress.com, where the file is sync'ed verbatim.
*/
function jetpack_markdown_posting_always_on() {
// why oh why isn't there a remove_settings_field?
global $wp_settings_fields;
if ( isset( $wp_settings_fields['writing']['default'][ WPCom_Markdown::POST_OPTION ] ) ) {
unset( $wp_settings_fields['writing']['default'][ WPCom_Markdown::POST_OPTION ] );
}
}
add_action( 'admin_init', 'jetpack_markdown_posting_always_on', 11 );

0 comments on commit 71752a9

Please sign in to comment.