Skip to content

Instantly share code, notes, and snippets.

@Anatal
Last active December 12, 2022 09:45
Show Gist options
  • Save Anatal/07e2c597685c9d82e815950dd8d0d640 to your computer and use it in GitHub Desktop.
Save Anatal/07e2c597685c9d82e815950dd8d0d640 to your computer and use it in GitHub Desktop.
Disable Gutenberg Posts & Post Type (or for sfwd-certificates post type in LMS LearnDash)
<?php
// disable gutenberg for posts
//==============================
add_filter('use_block_editor_for_post', '__return_false', 10);
// disable gutenberg for post types
//===========================
add_filter('use_block_editor_for_post_type', '__return_false', 10);
//*****--- Remove Gutenberg Block Library CSS from loading on the frontend ---*****
//===================================================================
function smartwp_remove_wp_block_library_css(){
wp_dequeue_style( 'wp-block-library' );
wp_dequeue_style( 'wp-block-library-theme' );
}
add_action( 'wp_enqueue_scripts', 'smartwp_remove_wp_block_library_css' );
// for the next post type of LMS LearnDash - disable all the above
// disable gutenberg for post type sfwd-certificates
//====================================================
add_filter('use_block_editor_for_post_type', 'prefix_disable_gutenberg', 10, 2);
function prefix_disable_gutenberg($current_status, $post_type)
{
if ($post_type !== 'sfwd-certificates') return false;
return $current_status;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment