Created
January 22, 2019 17:25
-
-
Save toshotosho/109ec080dcffbb711be4d0f0db99d5f5 to your computer and use it in GitHub Desktop.
Dequeue block library
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function custom_theme_assets() { | |
// bail if classic editor setting is set to block or no-replace | |
$option = get_option( 'classic-editor-replace' ); | |
if ( $option === 'block' || $option === 'no-replace' ) { | |
return; | |
} | |
// bail if classic editor plugin is not active. can't use is_plugin_active() here, unless you include wp-admin/includes/plugin.php | |
if ( ! in_array( 'classic-editor/classic-editor.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) { | |
return; | |
} | |
// dequeue the block library, so that you don't have /wp-includes/css/dist/block-library/style.min.css in each and every page of your site | |
wp_dequeue_style( 'wp-block-library' ); | |
} | |
add_action( 'wp_enqueue_scripts', 'custom_theme_assets', 100 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment