settings = new Disable_Gutenberg_Settings( $this->options ); $this->maybe_disable_gutenberg_editor(); } /** * Disable the block editor sitewide, either directly or (when Pro is * active) by deferring to Pro's own disable logic via an action. * * @return void */ public function maybe_disable_gutenberg_editor() { if ( ! empty( $this->options['disable_sitewide'] ) ) { if ( Module_Registry::is_pro_active() ) { // This module boots during Free's own plugins_loaded pass // (priority 10), but Pro's Bootstrap_Pro — the thing that // constructs Disable_Gutenberg_Pro and subscribes it to // this action — doesn't run until plugins_loaded priority // 20. Firing the action here would reach zero listeners, so // defer it to a later priority on the same plugins_loaded // pass, after Pro has had a chance to subscribe. add_action( 'plugins_loaded', function () { do_action( 'adminoptim_pro_disable_gutenberg' ); }, 30 ); } else { add_filter( 'gutenberg_can_edit_post', '__return_false', 5 ); add_filter( 'use_block_editor_for_post', '__return_false', 5 ); } } } }