diff --git a/includes/ConvertToBlocks/Settings.php b/includes/ConvertToBlocks/Settings.php index 224ea2d..6ad58c0 100644 --- a/includes/ConvertToBlocks/Settings.php +++ b/includes/ConvertToBlocks/Settings.php @@ -191,7 +191,7 @@ public function register_fields() { public function field_post_types() { $post_types = get_option( sprintf( '%s_post_types', CONVERT_TO_BLOCKS_SLUG ), - apply_filters( 'convert_to_blocks_default_post_types', CONVERT_TO_BLOCKS_DEFAULT_POST_TYPES ) + Plugin::get_instance()->get_default_post_types() ); $output_html = ''; @@ -236,20 +236,27 @@ public function filter_notice() { return; } - // URL to the settings panel. - $settings_url = add_query_arg( - [ 'page' => CONVERT_TO_BLOCKS_SLUG ], - admin_url( 'options-general.php' ) + $show_on_pages = array( + 'settings_page_convert-to-blocks', + 'plugins', ); + + $screen = get_current_screen(); + + if ( is_null( $screen ) ) { + return; + } + + if ( ! ( ! empty( $screen->post_type ) || in_array( $screen->id, $show_on_pages, true ) ) ) { + return; + } + ?>

', - '' + esc_html__( 'A filter hook (post_type_supports_convert_to_blocks) is already active.', 'convert-to-blocks' ), ); ?>