Display Pointer only once?

The idea of the pointer is to update the user meta when the pointer is closed. This is what will prevent the pointer from displaying on every page load. Once the user clicks “Close”.. that user meta pointer key is updated.

So, add a post method to your close function:

close: function() {
    // Once the close button is hit
    $.post (ajaxurl, {
        pointer: 'dismiss_my_pointer',
        action: 'dismiss-wp-pointer'
    });
}

Then, in the page where you are calling the pointer, you need to enqueue the necessary files:

function my_enqueue_scripts () {
    $dismissed = explode (',', get_user_meta (wp_get_current_user ()->ID, 'dismissed_wp_pointers', true));
    $not_in_array = !in_array ('dismiss_my_pointer', $dismissed);
    if ($not_in_array) {
        wp_enqueue_style ('wp-pointer');
        wp_enqueue_script ('wp-pointer');
        wp_enqueue_script ('utils');
    }
}
add_action('admin_enqueue_scripts', 'my_enqueue_scripts');

NOTE 1: You need to run a check to make sure you are only enqueueing this script on the page where you need.

NOTE 2: The ajaxurl in the post request might first need to be defined (if using this on the viewer side). You can define a global namespaced variable to pass the url to your js file.

error code: 523