WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

I've created something using reverse tags – when something isn't tagged, it's flagged up to say "Hey! This post hasn't been checked yet!"

Now i'm wondering, is there a way to get the last tag created?

Do tags have modified / created dates? Is there a way of getting around this if they haven't?

The user case I have is security patches for a CMS and I have a team who are documenting everything about it. I want them to create a new tag for the patch, then have a notice display saying "New patch available"

Anyone crossed anything like this before?

share|improve this question
Tags don't have dates. However, you can save this data in the new term meta table when you create new tags – Pieter Goosen Feb 19 at 12:17
up vote 9 down vote accepted

Following @PieterGoosen's (credit due) train of thought hook onto the following:

function update_term_timestamps($term_id) {

    switch( current_filter() ) {
        case 'created_term':
            update_term_meta($term_id, '_term_created_at', current_time('mysql', true));
        case 'edited_term':
            update_term_meta($term_id, '_term_edited_at', current_time('mysql', true));


add_action('created_term', 'update_term_timestamps');
add_action('edited_term', 'update_term_timestamps');

Now the meta data is accessible with:

//for created timestamp...
$timestamp = get_term_meta($term_id, '_term_created_at', true);

//for edited timestamp...
$timestamp = get_term_meta($term_id, '_term_edited_at', true);
share|improve this answer
... I see a popular plugin in the making here ;-) – birgire Feb 19 at 12:56
Looking very promising :D – Andrew Lazarus Feb 19 at 13:35
@toscho good idea... sketching out a prototype. – userabuser Feb 19 at 13:45
@userabuser Imagine being able to query these dates too – Andrew Lazarus Feb 19 at 14:56
@AndrewLazarus on my list too... I'll post back to this thread with a link to the repository when ready. – userabuser Feb 19 at 14:58

Your Answer


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

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