Support » Fixing WordPress » Adding an age as a custom meta value

  • Hello.

    I am building a search script that will filter results based on ages. (Posts are people on my site) The age is entered as a date of birth in a custom field. I am confident I can write a function to convert this date of birth to an age, then add it again as another custom field.

    My only worry is, what happens each year when they get older? I am not too sure what to do. I could have a script that runs each day…but this feels like a cheat.

    Any ideas?

    Many thanks
    Lewis

Viewing 1 replies (of 1 total)
  • esmi

    (@esmi)

    Forum Moderator

    Why store the age when you already have a date of birth? The search script should be able to calculate current age on-the fly using the current date.

Viewing 1 replies (of 1 total)
  • The topic ‘Adding an age as a custom meta value’ is closed to new replies.