wp_ajax_dismiss_wp_pointer() WordPress Function

The wp_ajax_dismiss_wp_pointer() function is used to dismiss a WordPress pointer.

wp_ajax_dismiss_wp_pointer() #

Ajax handler for dismissing a WordPress pointer.


Source

File: wp-admin/includes/ajax-actions.php

function wp_ajax_dismiss_wp_pointer() {
	$pointer = $_POST['pointer'];

	if ( sanitize_key( $pointer ) != $pointer ) {
		wp_die( 0 );
	}

	//  check_ajax_referer( 'dismiss-pointer_' . $pointer );

	$dismissed = array_filter( explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) ) );

	if ( in_array( $pointer, $dismissed, true ) ) {
		wp_die( 0 );
	}

	$dismissed[] = $pointer;
	$dismissed   = implode( ',', $dismissed );

	update_user_meta( get_current_user_id(), 'dismissed_wp_pointers', $dismissed );
	wp_die( 1 );
}


Top ↑

Changelog

Changelog
VersionDescription
3.1.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More