I have a custom meta field for a page that contains a future date. I'm wanting to make sure this is always a future date and have decided the best way to do so is by creating an admin pointer if the date is in the past. The only problem is the default way to close the pointer sets user_meta_data I want to use a cookie instead and nag the user daily until the date is changed.

Okay here is some code examples:

add_action( 'admin_enqueue_scripts', 'nifty_admin_enqueue_scripts' );
function nifty_admin_enqueue_scripts() {
    // Using Pointers
    wp_enqueue_style( 'wp-pointer' );
    wp_enqueue_script( 'wp-pointer' );

    // Register our action
    add_action( 'admin_print_footer_scripts', 'nifty_admin_print_footer_scripts' );

function nifty_admin_print_footer_scripts() {
    $pointer_content = '<h3>Meetings are are of date</h3>';
    $pointer_content .= '<p>It seems that next meeting date is in the past. Please update this setting.</p>';
<script type="text/javascript">
jQuery(document).ready( function($) {
        content: '<?php echo $pointer_content; ?>',
        position: 'top',
        close: function() {
             $.post( ajaxurl, {
                pointer: 'nifty_pointer', //usermeta check name
                action: 'dismiss-wp-pointer' //ajax function

If you look at the admin-ajax.php you can see the dismiss-wp-pointer defined and follow the white rabbit back to where it sets the meta data.

I'm thinking there has to be a way to use a cookie instead. Any thoughts would be appreciated.


Originally I was thinking I would need to do this using a cookie, but now that I think about it more I see that this is only ONE option. I've outlined some others below in hopes that someone will have an idea how to do them.

  1. Use 2 user meta values one that has the date they last closed it and one has the reset value
  2. Use wp_cron and delete the key value each day
  3. Have the date be part of the key value (ie nifty_$epochtime) then loop through user meta data and split the nifty key on _ and check the date with current date.
  4. Orignal way use a cookie instead.

The only problem is I don't know how to do any of these or which one would work best.

  • why would you want to use a cookie instead?
    – Bainternet
    Feb 21, 2013 at 8:01
  • @Bainternet I don't want to permanently dismiss the message just for say 24 hours or until my condition (the meta key value date is in the future) is true. It doesn't have to be a cookie just a temp dismissal.
    – Brooke.
    Feb 21, 2013 at 16:24
  • Updated Question with some ideas.
    – Brooke.
    Feb 21, 2013 at 19:23

1 Answer 1


You can override the action wp_ajax_dismiss-wp-pointer and user your own version of the function wp_ajax_dismiss_wp_pointer.

add_action( 'wp_ajax_dismiss-wp-pointer', 'override_ajax_pointer', 1 );

function override_ajax_pointer() 
    // Your version of the function wp_ajax_dismiss_wp_pointer

This is the same technique used in this Q&A: Display custom list of tags in post/page editor with hooks and learned in this SO Answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.