diff --git a/projects/plugins/jetpack/_inc/lib/core-api/class.jetpack-core-api-module-endpoints.php b/projects/plugins/jetpack/_inc/lib/core-api/class.jetpack-core-api-module-endpoints.php index a71d8159b560..4a25a61448a4 100644 --- a/projects/plugins/jetpack/_inc/lib/core-api/class.jetpack-core-api-module-endpoints.php +++ b/projects/plugins/jetpack/_inc/lib/core-api/class.jetpack-core-api-module-endpoints.php @@ -1829,15 +1829,3 @@ function jetpack_do_after_gravatar_hovercards_deactivation() { update_option( 'gravatar_disable_hovercards', 'disabled' ); } add_action( 'jetpack_deactivate_module_gravatar-hovercards', 'jetpack_do_after_gravatar_hovercards_deactivation' ); - -/** - * Actions performed only when Markdown is activated through the endpoint call. - * - * @since 4.7.0 - */ -function jetpack_do_after_markdown_activation() { - - // When Markdown is activated, enable support for post editing automatically. - update_option( 'wpcom_publish_posts_with_markdown', true ); -} -add_action( 'jetpack_activate_module_markdown', 'jetpack_do_after_markdown_activation' ); diff --git a/projects/plugins/jetpack/changelog/fix-markdown-posts-reset-on-upgrade b/projects/plugins/jetpack/changelog/fix-markdown-posts-reset-on-upgrade new file mode 100644 index 000000000000..3901b2f94c71 --- /dev/null +++ b/projects/plugins/jetpack/changelog/fix-markdown-posts-reset-on-upgrade @@ -0,0 +1,4 @@ +Significance: patch +Type: bugfix + +Markdown: Keep Markdown for posts off after a Jetpack update when it was turned off. diff --git a/projects/plugins/jetpack/class.jetpack.php b/projects/plugins/jetpack/class.jetpack.php index e4451d50bee8..6644f2a08a57 100644 --- a/projects/plugins/jetpack/class.jetpack.php +++ b/projects/plugins/jetpack/class.jetpack.php @@ -499,11 +499,6 @@ public 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 ); - } - /* * Minileven deprecation. 8.3.0. * Only delete options if not using diff --git a/projects/plugins/jetpack/modules/markdown.php b/projects/plugins/jetpack/modules/markdown.php index c579bbace558..04d29ba14e4d 100644 --- a/projects/plugins/jetpack/modules/markdown.php +++ b/projects/plugins/jetpack/modules/markdown.php @@ -33,3 +33,17 @@ function jetpack_markdown_posting_always_on() { } } add_action( 'admin_init', 'jetpack_markdown_posting_always_on', 11 ); + +if ( ! function_exists( 'jetpack_do_after_markdown_activation' ) ) { + /** + * Turn on Markdown for posts when the module is activated, by any path. + * + * Lives here because Modules::activate() loads this file before it fires the activation hook. + * + * @since 4.7.0 + */ + function jetpack_do_after_markdown_activation() { + update_option( 'wpcom_publish_posts_with_markdown', true ); + } +} +add_action( 'jetpack_activate_module_markdown', 'jetpack_do_after_markdown_activation' );