The problem here is that if the site is actually using something like Redis, or any other supported “external cache” then nothing is going to actually be set in the options table (which can be checked with wp_using_ext_object_cache
)
Storage in the options table is just how WordPress handles transients outside of any external caching (or local object caching).
With that said, to calculate the time remaining, you would do something like this:
$expires = (int) get_option( '_transient_timeout_MY_TRANSIENT_NAME', 0 );
$time_left = $expires - time();
The value for expiration is calculated by adding time()
to the value passed when setting the transient, so to get time left, just subtract time()
from the value set for expiration
Related Posts:
- How to make sure that only one wp_cron() runs at a time?
- get_transient(), PHP switch(), and comparison operators
- Web scraping using transients
- How to use transient in this code for related post?
- Delete a WordPress transient from a shortcode on Page/Post update
- Store a default value for a transient on plugin activation
- WordPress transient not working with WP Engine
- Set user status to absent on WordPress
- Using transients to store form notifications
- Transient Loop Not working as expected
- Should I use spl_autoload_register() in my plugin?
- List of all theme customizer control types?
- Installing wp3.2.1 on IIS; getting empty sessions
- WordPress widget in custom theme
- external wordpress pages using wp-blog-header
- Specific Loop For 2 Within Each
- Why WordPress uses 4 tables to manage terms
- How do I enable HTML5 prefetching on this page?
- Anything I can add to functions.php to make text widgets accept PHP?
- user_id error: Only variables should be passed by reference
- How to find the output of contact form 7 shortcode? [closed]
- Is it necessary to upgrade to php7? [closed]
- get_users(…) only returns one user
- Store and Work with huge array in WP [closed]
- How to disable the password strength meter script on reset password page?
- Dynamic Stylesheet loads but doesn’t finish
- How to upload a file to a folder named after the user_id via plugin
- Can’t access variable outside for loop
- add custom link to wordpress media gallery modal
- How to show single category archive
- Dynamic content based on a URL parameter
- Hide subcategories (widget)
- How to Reference/Echo Variable from Another PHP Function
- Replace shortcode in substring
- Include a PHP file inside an array
- Getting content from a referenced post
- How do I modify the custom footer text and get theme version number to show in wordpress admin?
- How to use html inside a functions.php code?
- Nested “do” and “add” Actions is possible?
- Deprecated: Function create_function() is deprecated [closed]
- displaying content that includes shortcodes within an echo
- Double jQuery loaded
- Trying to prepend a Hashtag symbol to the_tags links [closed]
- Liking a facebook page from wordpress website?
- How do I define a lookup table that will work across all PHP elements of the template?
- trouble with page_id & highlighting current page
- Get the last 5 products from each category
- Why does the Woocommerce grouped template prints the unpublished products?
- How to use two meta_compare in an array?
- How to hook a logout funtion for specific usr role in wordpress?
- Custom post type category not displaying category ID
- Advice on creating a WP Archive Template with Custom Taxonomy (get_term_meta)
- Fatal error: Cannot redeclare function
- Convert canvas to image and upload image to server
- How to get the filename from file system and create a download link?
- PHP getting error when trying to access WP-Admin Dashboard
- Only load certain artists on this page
- Using flickr api in custom wordpress plugin
- Toolbar Hidden in a Virtual Page
- Conditional for Post Format
- Woocommerce order status payment
- How to Insert Ads After Every X Paragraph PHP
- How to define a rule in functions.php that ONLY disables the default wp functionality that undesirably changes ‘&’ to ‘#038;’?
- Dynamically added custom fields not displayed on WooCommerce email notifications
- End of blog roll or start of blog roll, _post_link = false / no link
- How to set a parrent page to single-post
- How to Remove Theme Style CSS inside Custom Plugin?
- get different meta-data of a complicated query at the same time
- If is_page include/else not working all of a sudden
- Run PHP 24hrs After Event Trigger
- Ajax result show in console if is called outside function and not showing in array
- Can I split a huge wp_postmeta table across different databases or servers?
- ACF – Custom image for Product Tags not displaying
- Does WordPress disable system functions?
- WordPress AJAX PHP(html) file that is within WordPress Loop
- Add Shortcode to ::before class
- How to display custom seo title before the loop?
- WooCommerce get products based on the taxonomy
- Parsing webhook from Shopify in WordPress
- Check if a user is logged into my WordPress site which is on a different server
- How to add text before posts
- Add div after every 4 posts then every 2 posts for a responsive loop
- Update same content in multiple posts at once?
- Different home page for logged off users
- Issue adding featured image option to functions.php
- What to create new post using wp_insert_post, but it repeat the post infinitely
- Non-static method error when trying to use class in widgets
- Send data from plugin to external database
- Allow the execution of an external PHP script for logged users
- Get terms of the posts with one query
- Changes in header.php not reflecting
- Modify php code to pass a page id as a parameter in order to create a breadcrumb
- Newly published content gives 404 on wordpress
- Show custom default avatar instead of gravatar
- Get unique post in parent category
- How to display the date under the post title?
- Parse error: syntax error, unexpected ‘}’ in C:\xampp\htdocs\admin\products.php on line 148 [closed]
- Advanced Custom Fields Show PHP in Text Areas
- New to WordPress & Freelancing [closed]
- Custom plugin doesn’t show in admin menu – when code added, displays an empty page