Last active
December 12, 2022 09:45
-
-
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)
This file contains hidden or 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
<?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