| @@ -26,9 +26,15 @@ | ||
| 26 | 26 | */ |
| 27 | 27 | public static function init() { |
| 28 | 28 | add_action( 'init', array( __CLASS__, 'register_blocks' ) ); |
| 29 | 29 | |
| 30 | - add_filter( 'block_categories', array( __CLASS__, 'block_categories' ) ); | |
| 30 | + // Deprecation notice after 5.8.0. | |
| 31 | + global $wp_version; | |
| 32 | + if ( $wp_version && version_compare( $wp_version, '5.8', '<' ) ) { | |
| 33 | + add_filter( 'block_categories', array( __CLASS__, 'block_categories' ) ); | |
| 34 | + } else { | |
| 35 | + add_filter( 'block_categories_all', array( __CLASS__, 'block_categories' ) ); | |
| 36 | + } | |
| 31 | 37 | } |
| 32 | 38 | |
| 33 | 39 | /** |
| 34 | 40 | * Register block categories. |