diff --git a/lib/hooks.php b/lib/hooks.php index 5ce5026..d89d1a3 100644 --- a/lib/hooks.php +++ b/lib/hooks.php @@ -138,6 +138,28 @@ add_filter( } ); +/** + * Remove unused or replaced core blocks + * + * @return array List of allowed block types + */ +add_filter( + 'allowed_block_types_all', + function () { + // get all the registered blocks + $blocks = \WP_Block_Type_Registry::get_instance()->get_all_registered(); + + // then disable some of them + unset( $blocks['core/media-text'] ); + unset( $blocks['core/calendar'] ); + unset( $blocks['core/buttons'] ); + unset( $blocks['core/search'] ); + + // return the new list of allowed blocks + return array_keys( $blocks ); + } +); + /** * WP Cleanup */ @@ -241,6 +263,13 @@ add_action( } ); +/** + * Disable Gravity Forms theme CSS + */ +add_filter( 'gform_disable_css', '__return_true' ); +add_filter( 'gform_disable_form_theme_css', '__return_true' ); +add_filter( 'gform_disable_form_legacy_css', '__return_true' ); + /** * Filters the email address used as the sender in outgoing emails. *