Skip to content

Instantly share code, notes, and snippets.

@jeherve
Last active November 26, 2020 16:16
Show Gist options
  • Save jeherve/650d6ce57898021bc3c443e55d812811 to your computer and use it in GitHub Desktop.
Save jeherve/650d6ce57898021bc3c443e55d812811 to your computer and use it in GitHub Desktop.
[Jetpack] A little plugin to strip down Jetpack until all what's left is the Markdown block
<?php
/**
* Plugin Name: Markdown from Jetpack
* Plugin URI: https://jetpack.com
* Description: Use only the Markdown block in Jetpack, nothing else. This must be installed in addition to the Jetpack plugin.
* Author: Automattic
* Version: 1.0.0
* Author URI: https://jetpack.com
* License: GPL2+
* Requires at least: 5.5
* Requires PHP: 5.6
*/
/*
* Disable Jetpack's connection to WordPress.com.
* Allows you to use all features that do not require a connection to WordPress.com.
*/
add_filter( 'jetpack_offline_mode', '__return_true' );
/*
* Only load the Markdown block.
* Other blocks in Jetpack will not be available.
*/
add_filter( 'jetpack_set_available_extensions', function() { return [ 'markdown' ]; } );
/*
* Do not load extra tools available in Jetpack,
* such as Facebook and Instagram embeds for sites that need them.
*/
add_filter( 'jetpack_tools_to_include', '__return_empty_array' );
/*
* Do not let any module be available in the Jetpack UI,
* and do not allow one to turn modules on in any way.
*/
add_filter( 'jetpack_get_default_modules', '__return_empty_array' );
add_filter( 'jetpack_get_available_modules', '__return_empty_array' );
/*
* In fact, let's remove the Jetpack menu altogether.
* Note: you don't want to do that if other plugins on your site (such as the Akismet plugin) nest their menu items
* under the Jetpack main menu.
* In such cases, you'd want to remove the menu item only for non-admins for example.
*/
add_action( 'admin_menu', function() {
remove_menu_page( 'jetpack' );
}, 999 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment