Skip to content

Commit

Permalink
fix notice hide scope
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabiermi committed May 2, 2024
1 parent 39914c2 commit 6ca0f1c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 22 deletions.
32 changes: 16 additions & 16 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 4 additions & 6 deletions omnisend/class-omnisend-core-bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public static function load(): void {
// phpcs:ignore because linter could not detect internal, but it is fine
add_filter('cron_schedules', 'Omnisend_Core_Bootstrap::cron_schedules'); // phpcs:ignore
add_action( 'rest_api_init', 'Omnisend_Core_Bootstrap::omnisend_register_connection_routes' );
add_action( 'in_admin_header', 'Omnisend_Core_Bootstrap::hide_notices' );
add_action( 'admin_head', 'Omnisend_Core_Bootstrap::hide_notices' );

add_action( 'admin_notices', 'Omnisend_Core_Bootstrap::admin_notices' );
add_action( 'admin_menu', 'Omnisend_Core_Bootstrap::add_admin_menu' );
Expand Down Expand Up @@ -211,11 +211,9 @@ public static function load_omnisend_site_styles(): void {
}

public static function hide_notices(): void {
if ( isset( $_SERVER['REQUEST_URI'] ) ) {
$request_uri = esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) );
if ( strpos( $request_uri, '/wp-admin/admin.php?page=omnisend' ) !== false ) {
echo '<style>[class*="notice"]:not([class*="components"], .omnisend-notice, .notice), .notice:not(.omnisend-notice) { display: none !important; }</style>';
}
$screen = get_current_screen();
if ( $screen && ( $screen->id === 'toplevel_page_omnisend' || $screen->id === 'omnisend-email-marketing_page_omnisend-app-market' ) ) {
echo '<style>[class*="notice"]:not([class*="components"], .omnisend-notice, .notice), .notice:not(.omnisend-notice) { display: none !important; }</style>';
}
}

Expand Down

0 comments on commit 6ca0f1c

Please sign in to comment.