WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

we have an image viewer on our website where admins can tag images thought ajax (new feature on Wordpress 3.0). We are tagging just fine, but we need to filter when they were tagged. We are using normal add_post_meta to update the tagging for the images but I would like to know what's best way to attach time/date on it.

this is our ajax format

$imgID = (!empty($_POST['imgID'])) ? (int) $_POST['imgID'] : '';
            $value = (!empty($_POST['value'])) ? trim(stripslashes($_POST['value'])) : '';
            $action = (!empty($_POST['act']) && in_array($_POST['act'], array('add', 'remove'))) ? $_POST['act'] : 'add';
            if (!empty($imgID) && !empty($value))
                if ('remove' == $action)
                    delete_post_meta($imgID, 'image_tag', $value);
                else if ('add' == $action)
                    $ctags = get_post_meta($imgID, 'image_tag');
                    if ((is_array($ctags) && !in_array($value, $ctags)) || !is_array($ctags) || !$ctags)
                        add_post_meta($imgID, 'image_tag', $value);


My first thought is to create new db table. but if there is something easier that I am missing on WP it would be awesome to know.

thanks in advance

share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.