Storing temporary data for a custom post type

I've created a Rental custom post type for a rental site I'm developing for a client. I'd like to add an ajax availability calendar in the backend so the client can mark/unmark unavailable dates clicking on them, such as this:

I need to temporary store the marked dates somewhere so they don't get lost when the client moves through months back and forth. I'm wondering if using transients is the best option for this. Any ideas?

Thanks in advance

Topic transient calendar ajax Wordpress

Category Web


If you're using custom post types, i'd save those date entries as post_meta entries (http://codex.wordpress.org/Function_Reference/add_post_meta). So if your client clicks on a date, you start an ajax request to your plugin/theme file to add or remove a meta entry.

you can create one meta_entry named _availability for example and save all dates there (you can save multiple meta_entries to a post with the same name <= 1:n)

saving your dates as meta entries has the additional benefit that you can start a WP_Query that shows you all properties available today very easily.

br from salzburg,

  • Johannes

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.