gtm4wp_dismiss_notice

The Google Tag Manager for WordPress gtm4wp dismiss notice function.

Description

gtm4wp_dismiss_notice(); 

Usage

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

Defined (1)

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

/admin/admin.php  
  1. function gtm4wp_dismiss_notice() { 
  2. global $gtm4wp_def_user_notices_dismisses, $current_user; 
  3.  
  4. $gtm4wp_user_notices_dismisses = get_user_meta( $current_user->ID, GTM4WP_USER_NOTICES_KEY, true ); 
  5. if ( $gtm4wp_user_notices_dismisses === "" ) { 
  6. $gtm4wp_user_notices_dismisses = $gtm4wp_def_user_notices_dismisses; 
  7. } else { 
  8. $gtm4wp_user_notices_dismisses = @unserialize( $gtm4wp_user_notices_dismisses ); 
  9. if ( false === $gtm4wp_user_notices_dismisses ) { 
  10. $gtm4wp_user_notices_dismisses = array(); 
  11. $gtm4wp_user_notices_dismisses = array_merge( $gtm4wp_def_user_notices_dismisses, $gtm4wp_user_notices_dismisses ); 
  12.  
  13. $noticeid = trim( basename( $_POST["noticeid"] ) ); 
  14. if ( array_key_exists( $noticeid, $gtm4wp_user_notices_dismisses ) ) { 
  15. $gtm4wp_user_notices_dismisses[ $noticeid ] = true; 
  16. update_user_meta( $current_user->ID, GTM4WP_USER_NOTICES_KEY, serialize( $gtm4wp_user_notices_dismisses ) );