wp_ajax_dismiss_wp_pointer

Ajax handler for dismissing a WordPress pointer.

Description

wp_ajax_dismiss_wp_pointer(); 

Usage

  1. if ( !function_exists( 'wp_ajax_dismiss_wp_pointer' ) ) { 
  2. require_once ABSPATH . '/wp-admin/includes/ajax-actions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = wp_ajax_dismiss_wp_pointer(); 
  7.  

Defined (1)

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

/wp-admin/includes/ajax-actions.php  
  1. function wp_ajax_dismiss_wp_pointer() { 
  2. $pointer = $_POST['pointer']; 
  3. if ( $pointer != sanitize_key( $pointer ) ) 
  4. wp_die( 0 ); 
  5.  
  6. // check_ajax_referer( 'dismiss-pointer_' . $pointer ); 
  7.  
  8. $dismissed = array_filter( explode( ', ', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) ) ); 
  9.  
  10. if ( in_array( $pointer, $dismissed ) ) 
  11. wp_die( 0 ); 
  12.  
  13. $dismissed[] = $pointer; 
  14. $dismissed = implode( ', ', $dismissed ); 
  15.  
  16. update_user_meta( get_current_user_id(), 'dismissed_wp_pointers', $dismissed ); 
  17. wp_die( 1 );