hide_non_monsterinsights_warnings

Remove non-MI notices from MI page.

Description

(null) hide_non_monsterinsights_warnings(); 

Returns (null)

Return early if not on the proper screen.


Usage

  1. if ( !function_exists( 'hide_non_monsterinsights_warnings' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'google-analytics-for-wordpress-by-monsterinsights/includes/admin/common.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = hide_non_monsterinsights_warnings(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/includes/admin/common.php  
  1. function hide_non_monsterinsights_warnings () { 
  2. // Bail if we're not on a MonsterInsights screen. 
  3. if ( empty( $_REQUEST['page'] ) || strpos( $_REQUEST['page'], 'monsterinsights' ) === false ) { 
  4. return; 
  5.  
  6. global $wp_filter; 
  7. if ( !empty( $wp_filter['user_admin_notices']->callbacks ) && is_array( $wp_filter['user_admin_notices']->callbacks ) ) { 
  8. foreach( $wp_filter['user_admin_notices']->callbacks as $priority => $hooks ) { 
  9. foreach ( $hooks as $name => $arr ) { 
  10. if ( !empty( $name ) && strpos( $name, 'monsterinsights' ) === false ) { 
  11. unset( $wp_filter['user_admin_notices']->callbacks[$priority][$name] ); 
  12.  
  13. if ( !empty( $wp_filter['admin_notices']->callbacks ) && is_array( $wp_filter['admin_notices']->callbacks ) ) { 
  14. foreach( $wp_filter['admin_notices']->callbacks as $priority => $hooks ) { 
  15. foreach ( $hooks as $name => $arr ) { 
  16. if ( !empty( $name ) && strpos( $name, 'monsterinsights' ) === false ) { 
  17. unset( $wp_filter['admin_notices']->callbacks[$priority][$name] ); 
  18.  
  19. if ( !empty( $wp_filter['all_admin_notices']->callbacks ) && is_array( $wp_filter['all_admin_notices']->callbacks ) ) { 
  20. foreach( $wp_filter['all_admin_notices']->callbacks as $priority => $hooks ) { 
  21. foreach ( $hooks as $name => $arr ) { 
  22. if ( !empty( $name ) && strpos( $name, 'monsterinsights' ) === false ) { 
  23. unset( $wp_filter['all_admin_notices']->callbacks[$priority][$name] );