Guys found the solution at **stackoverflow**
:
You can use set_transient
function after someone booked a car. I assume a car is post type and all post have a unique ID. So after a car is booked you create a transient which expires after one hour. Check Documentation. Your code might have the next logic.
set_transient( $post_id . '_car_is_booked', true, HOUR_IN_SECONDS );
You set transient for HOUR_IN_SECONDS
it is a special WordPress variable and after one hour it will be removed from the database automatically. So to find our is this car is booked or not you can use function get_transient
get_transient Docs.
// return false if option does not exists
get_transient( $post_id . '_car_is_booked' );
And if transient
for specific post ID exists it means the car is booked less then one hour ago.
Related Posts:
- Is there a flowchart for WordPress loading sequence?
- How do register_sidebar() and get_sidebar() work together?
- Multiple WordPress sites with docker
- .maintenance and maintenance.php also in multisite install?
- Is it possible to change the attributes of a registered style or script before it fires?
- how to redirect to a custom password retrieval page
- Is there a plugin to make attaching images easier?
- how to change “published date” format on edit.php (Posts page)?
- Custom category order with get_categories
- How to change submit button value in comment from “Post Comment” to “Send”
- Pagination Help on Crazy Custom Authors Page
- Getting rid of the #038; when string replacing content
- Querying multiple WordPress custom fields with AND qualifier
- WordPress custom post types breaks permalink on theme reinstall
- Creating a searchable A-Z listing of hundreds of companies/services
- Show attribute description when filtering by that attribute
- Create a Custom menu item fetched by Product Categories and Sub Categories
- Multi-Site Plugin Activated (Not Network-Activated), What Happens?
- Add custom column to Users admin panel with Types user custom fields?
- How do I change the default admin color scheme in MP6
- woocommerce Add custom field set like billing fields
- Adding action to save_post, post needs to be saved twice for function to work
- Calling a php file from a javascript file in wordpress
- 1 bit audio player
- Outputting posts from post id´s in variable
- Auto redirect after session expire, but only for one user
- How to update preview when custom setting changed in my custom widget
- Hide editor with specific post meta value
- Custom URL going to 404
- TinyMCE custom dialog with selectbox not working
- Load more posts with multiple queries
- WordPress slugs and 404 handling takes preference over folders in site root?
- Suggestions for Implementing a Wedding Website in WordPress?
- Add a date updated/date modified option using custom fields
- How to wrap the list with custom class using wp_nav_menu?
- Custom search to display results within same page
- How do I change .css versioning?
- Get ORIGINAL image links from get_post_gallery
- change url for static files in /wp-admin with a cdn url
- Save title as custom field on custom post type
- Qtranslate + Woocommerce (multiple tinymce) [closed]
- CSS Customizations for certain page
- How can I have a common background color across multiple WordPress blocks?
- My custom sql query for getting a username giving me a warning and an error
- Get Custom Taxonomy Terms by Date
- Semi complicated custom taxonomy question
- Archive subtitles for different types of archives
- Point homepage to custom php page
- Duplicated content with custom shortcode
- Display a list of subcategories (from specific Category) a post belongs to
- Implement a Walker with custom object rather than WordPress database object
- Adding tags when creating new post
- How can I tag a menu item as visited for each unique user?
- Display posts by combining multiple meta key
- Custom Content Page
- Add Member’s birthdate from Backend and shows it on frontside [closed]
- How to add active state to the navigation links?
- How to add functionality to an existing theme (using child themes)
- How to Render Post Types in RSS Feed?
- How do I fix my static page
- URL and Site title outputting on Login page
- 404 when Previewing an unsaved draft
- List of contents of entire blog
- Display a specified content on a Page and all its child pages
- optimal taxonomy or custom post types
- Custom field not editable by the user
- WordPress category custom title
- How do I make mysite.com/comingsoon WordPress to become my main website’s WordPress?
- Use a custom page with dynamic content as a user profile page
- adding fade on mouseover to images
- Customize section does not show my widget areas
- Invitation link to a site in multisite network does not work?
- Add helper text in custom-header section in admin
- How to edit content in code view of home page when there is some theme applied?
- How to display strikethrough text in button text (for special offer)
- Remove Title and White Space in Twenty Twenty theme
- Lightbox not showing image caption
- WordPress core jquery version file not loaded?
- Can we add an extra button on woocommerce shop page and use it to send the product info including image in a mail?
- WP_User_Query Search Multiple Keywords from a Multi-Select Field?
- Add a custom intro page
- clickable toggle menu, help
- How to change custom link of subpages from of localhost to website
- twenty seventeen customizer duplicates section content
- How to append the excerpt to the content in the single post page?
- How to Password Protect whole site except for some subdirectories
- Custom dropdown search form that allows users to select option B based from Option 1
- Ordering a specific post type
- Header image doesn’t show up on page
- How to get name and email value from a custom form and add it to campaign monitor subscriber list?
- Custom Link In WordPress Media “Attachment Details” Upload Screen
- “Static” pages within a theme
- Assign classes to Custom fields
- Custom WordPress SQL Query 4 posts per custom taxonomy
- When is it OK to create a custom table for a plugin? [duplicate]
- Prevent posts from being published if the ‘Uncategorized’-category or no category is selected
- Disable all Fonts that are Standard in WordPress and replacing them with a custom Font?
- Custom product sorting archive page
- Add custom information in editor summary
- A Voting system for a pageants