I have three different custom fields, for day (01-07) hour (01-12) and minute (00-59) and I really need to combine them into one custom value so I can actually order them using wp_query.

I cant actually just use custom field for the whole thing; it would be easier I know, but it needs to be easy on the user to input day/time. So that option is out of the question.

Is it possible to join those three numerical values for use in wp_query?

Thanks in advance for any help.


  • What the user fills out need not look like what you put into the database. Give the user whatever form you think is best but save to the database in a format usable to PHP, MySQL, and WordPress.
    – s_ha_dum
    Commented Jan 28, 2013 at 19:44

1 Answer 1


If you want to make it as easy as possible on the user, then I think the best option would be to add a custom meta box with three fields for inputting the day/hour/minute values. Using something like a jQuery UI slider style timepicker would further simplify input. Then when the post is saved, use the save_post action to store those three values in a single field.

The second option is similar to the first, but you'd continue using the custom fields as you are now, except a fourth field would be added by you on the save_post action to combine them into a single field you use in your query.

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.